aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Question on TagExtensions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Question on TagExtensions" Watch "Question on TagExtensions" New topic
Author

Question on TagExtensions

kishore chitturi
Ranch Hand

Joined: Nov 28, 2004
Posts: 50
Hi,
If there is a jsp:useBean tag,why we r using tagextenisons?can any body tell me?

regards
kishore
chowdary Thammineedi
Ranch Hand

Joined: Aug 16, 2004
Posts: 126
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

Joined: Nov 28, 2004
Posts: 50
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

Joined: Nov 28, 2004
Posts: 102
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

Joined: May 24, 2004
Posts: 783
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!


“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Question on TagExtensions