This week's giveaway is in the Threads forum.
We're giving away four copies of Java Concurrency Live Lessons and have Doug Schmidt on-line!
See this thread for details.
Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP  RSS feed

 
priya shankar
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a JSp proj in what condition we use UseBean tag and Taglib..explanation pls
thankx
priya
 
narasimharao konjeti
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to encapsulate java code or to use the OO properties java(or logic, which is written in java). we shall go for jsp beans. And If you want to write your own tag like <jsp:include....> you should go for tag libs. Here in the case of bean we will retrive the info by using setXXX() and getXX() methods. But here in tag lib directly you can access the methods of a particular object/class. This is small and brief description about bean and taglib
cheers
 
arul murug
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In early days of JSP, people wrote the data retrieval, storage and formatting logics in the JSP page using scriplets and expressions.
The cluttered logic in the JSP page reduced the Modularity, Reusability and readability of the application.

Then the later versions of JSP brought the concept of including Java beans thru Usebean and Taglibs, which help us in removing these cluttered logic from the JSP pages.
In a broader sense,
Java Beans can be used to extract data retrieval and storage logic from the JSP.
Taglib can be used to extract the logic for Formatting the output.(For example formatting a HTML table from a resultset etc..)
Hope this helps..
 
Sakthivel Palanivelu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even now, in some cases we have to write some logic in JSP itself ( example.... after getting the result from a vector or some object.... You have to navigate to print the stuff. Else you have to have the HTML stuff inside your bean.... So cluttering will be still there
 
arul murug
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sakthi
In Existing JSP pages, I try(not always) to extract whenever I come across java code into a bean or custom tag.
New pages can be designed with out them.
In your case, I think custom Tag is a suitable candidate to replace the logic of printing values from vector and formatting inside a HTML table.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!