JSP Component Creation
Posted
by jboyd
on Stack Overflow
See other posts from Stack Overflow
or by jboyd
Published on 2010-06-16T13:59:07Z
Indexed on
2010/06/16
14:02 UTC
Read the original article
Hit count: 212
When creating JSP pages one thing that I'd often like is the ability to do something like this:
<jsp:include page="fancystoryrenderer.jsp" value="${aStoryObjectInMyModel}/>
...
fancystoryrenderer.jsp
<div id="fancymainbody">
...
${theStory.title}
...
</div>
The main important characteristics of this is that I can reuse the same component on the same JSP page in different places without having to copy paste the component and give the story variables different names, notice that the story is called "theStory" in the JSP and not "aStoryObjectInMyModel", the linkage between our model has been broken by the view, which is a good thing in this case
How do you do this?
© Stack Overflow or respective owner