| Author |
any tag for adding objects
|
joseph prabhu
Ranch Hand
Joined: Feb 26, 2008
Posts: 162
|
|
joe here my code is The above code gives the output; my question is instead of creating the object for LinkedList and add objects in it then reqeust.setAttribute("list",li); is there any tag in jsp for shortcut. we use <jsp:useBean></useBean> for usebean
|
 |
Steve Luke
Bartender
Joined: Jan 28, 2003
Posts: 3036
|
|
No, there isn't a tag for that. The reason is this is work that shouldn't really be done in the JSP. The JSP should be about displaying data, not performing logic. So that functionality should be mover - usually to a controller servlet that gets called before the JSP, but can also be moved into a JavaBean. For example: The idea is that your JSP doesn't really do any work. Ideally, you have a controller servlet that decides what data needs to be made available to the JSP, the servlet generates it (or has some other data object generate it) and then makes it available to the JSP. But, barring a refactoring of your entire code base to MVC, using a dummy JavaBean to do your work increases the separation of the display from the Model, and will make it easier to do that transition later on.
|
Steve
|
 |
 |
|
|
subject: any tag for adding objects
|
|
|