Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on TagExtensions

 
kishore chitturi
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
If there is a jsp:useBean tag,why we r using tagextenisons?can any body tell me?

regards
kishore
 
chowdary Thammineedi
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Kishore
This question is too vague. Can you please eloborate. Was this question on an interview. May be you got only half of it.

By the way what are TAG EXTENSIONS? JSP 2.0 has EL-Functions,TAG FILES
and CUSTOM TAGS(Simple Tag model and Classic Tag Model).I'm confused and worried man. :roll:
 
kishore chitturi
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chowdary,
Thank u for giving reply.We are using jsp:useBean tag for reusing,then why we need customtags.Can u explaing this one.

regards
kishore
 
Jose Esteban
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by kishore chitturi:
We are using jsp:useBean tag for reusing,then why we need customtags.Can u explaing this one.


That's one of the most weird questions I've read.

A jsp:useBean tag only makes a bean available in a page. With custom tags you can do a lot of things that have nothing to do with making beans available in a page.

I think you should study a little more the subject before posting so weird questions
 
Paul Bourdeaux
Ranch Hand
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by kishore chitturi:
Hi Chowdary,
Thank u for giving reply.We are using jsp:useBean tag for reusing,then why we need customtags.Can u explaing this one.

regards
kishore

Hi kishore,

If I understand you correctly, you are asking what the difference is between standard actions, such as <jsp:useBean> and custom tags. They are actually two very different things.

<jsp:useBean> is a standard action tag. There are other standard actions out there too, for instance <jsp:include> and <jsp:forward>. Each standard action tag provides a functionality reduces the need for scripting inside a jsp page. Specifically, <jsp:useBean> is used primarily for retrieving (or creating) attribute objects. When you use it, the Container looks for a matching attribute object in the specified scope. If no scope is specified, it uses the default page scope. If one does not exist, it will create a new instance of the class specified and make it an attribute (again in the specified scope).

Sometimes, however, you need more than the standard action tags can provide (or JSTL for that matter). That is when you can resort to custom tags. Now you can create your own tags to do what the standard ones could not. What if, for example, you had a database that stored all of your music files in it, and you wanted a jsp page to display the artist and song title based on some criteria given (like maybe the first letter of the song?)? You could create a custom tag that preformed the database search based on the criteria supplied and then iterated over the results, outputting the songs in table format. the in your jsp page, you would only have to use an EL expression to get your effect:Hope that helps clear it up!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic