One of Jakarta taglib�s set of tags named  "standard"(which is the java
standard tag lib (JSTL))has a sub-set "conditional tags" that would do it
for you. They are similar to the XSLT instructions for conditional
processing (<xsl:if> and <xsl:choose>).
In general these tags:
1.- require a JSP 1.2 container(Tomcat 4.x).
2.- rely on an "expression language"(the ECMAScript language has been set as
the default, meanwhile)
I haven�t looked the bundled examples yet but the  docs are superb.
Hope this help you.
-----Mensaje original-----
De: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]En nombre de
[EMAIL PROTECTED]
Enviado el: Mi�rcoles, 06 de Marzo de 2002 07:49 a.m.
Para: [EMAIL PROTECTED]
Asunto: Re: Fwd: How to use JSP Tags conditionally


Hi! Yup, its easy to create taglibraries
that will conditionally process/skip their
child content/tags. I beleive many taglibs
out there in the wild do it.

In addition to struts i can mantion the forthcoming JSTL (now only
early access releases are available), jakarta should have (maybe even
several) taglibs of that kind. I guess many many other handmade and
industrial quolity taglibs live now. There are some sites where
you can search for available taglibs, but now I just can't remember
the addresses.


VB> I should think that a tag is the better way...
VB> if you use struts there's a library "logic" which has
VB> a tag <present> in it to test a boolean value.
VB> I think it is also an example of tag creation in the
VB> Sun documentation about J2EE Servers (section JSP or
VB> tag handler, I don't remember).

VB> Hope it helped,
VB> Vincent


VB>  --- Sudarson Roy Pratihar
VB> <[EMAIL PROTECTED]> a �crit : > Date:
VB>  Wed, 6 Mar 2002 10:42:43 +0530
>>
>> Hi All,
>>
>> I have some jsp tags (say <mytag param1 param2/>).
>> Now I want to use it conditionally again and again
>> in my jsp like this:
>>
>> if(someBooleanVariable)
>> {
>>     use <mytag param1="val1" param2="val2"/>
>>     do some other html things
>> }
>>
>> else
>> {
>>     something else
>> }
>>
>> As these things have to be done in a number of place
>> within same jsp, I'm thinking about some method, say
>> myMethod(val1, val2, someBooleanVariable).
>>
>> My question is how can I do this ? Or can I make
>> some other tag that will server the purpose of this
>> method ?
>>
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to