This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JSP and the fly likes any tag for adding objects Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "any tag for adding objects" Watch "any tag for adding objects" New topic
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
    
    4

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: any tag for adding objects
 
Similar Threads
automatic display of the java list on mouseover an image
List Interface
Generic
Form a tree parent -childs from String
Generics..