Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2006

Tip: Looking for answers? Try searching our database.

How do i do  if-else  condition in Struts ?

Thread view: 
gk - 05 Mar 2006 18:13 GMT
How do i do  if-else  condition in Struts ?

logic:equal does not do it . how struts tag could be used in the JSP
page for an if-else condition ?

how  to do it ?

Can anybody provide an example ?
Aj-India - 06 Mar 2006 04:44 GMT
Example:

if(age == 18) {
//some action
}
else {
//some other action
}

In Struts:
<logic:equal name="age" value="18">
 <!-- some action -->
</logic:equal>
<logic:notEqual name="age" value="18">
   <!-- some other action -->
</logic:notEqual>

Cheers,
Aj
Luke Webber - 06 Mar 2006 04:50 GMT
> Example:
>
[quoted text clipped - 12 lines]
>     <!-- some other action -->
> </logic:notEqual>

Holy crap. Why do they even bother?

I'm sorry, it's not your fault, but why on Earth would anybody bother
using taglibs for this sort of thing when it makes the whole thing so
much more obscure? Scriptlets aren't something to be ashamed of - they
work well, they're efficient, and they're perfectly readable to anybody
who knows Java.

Sorry to vent, but I really, really, REALLY dislike Struts.

Luke
James McGill - 06 Mar 2006 05:46 GMT

> > In Struts:
> > <logic:equal name="age" value="18">
[quoted text clipped - 9 lines]
> using taglibs for this sort of thing when it makes the whole thing so
> much more obscure?

Whenever I see something like this, I'm praying that it's some kind of
auto-generated thing, and that the input to the generator is simpler
than the output.

Clearly there is a type of person that enjoys declarative programming
syntax using XML constructs, and there are lots of that type out there,
but I've never been one of them, and I hope I don't have to become
one...
Steve Sobol - 06 Mar 2006 06:21 GMT
> I'm sorry, it's not your fault, but why on Earth would anybody bother
> using taglibs for this sort of thing when it makes the whole thing so
> much more obscure? Scriptlets aren't something to be ashamed of - they
> work well, they're efficient, and they're perfectly readable to anybody
> who knows Java.

> Sorry to vent, but I really, really, REALLY dislike Struts.

It's not a taglib issue, it's a Struts issue. I like Struts mostly, and I
use Struts, but the lack of an "else" clause *is* just stupid.

Signature

Steve Sobol, Professional Geek   888-480-4638   PGP: 0xE3AE35ED
Company website: http://JustThe.net/
Personal blog, resume, portfolio: http://SteveSobol.com/
E: sjsobol@JustThe.net Snail: 22674 Motnocab Road, Apple Valley, CA 92307

Luke Webber - 08 Mar 2006 03:38 GMT
>> I'm sorry, it's not your fault, but why on Earth would anybody bother
>> using taglibs for this sort of thing when it makes the whole thing so
[quoted text clipped - 6 lines]
> It's not a taglib issue, it's a Struts issue. I like Struts mostly, and I
> use Struts, but the lack of an "else" clause *is* just stupid.

But again, why bother? For something that is so readily available via
scriptlets? It just leads to a splintering of standards so that I can't
read your code, because you employ a taglib that I don't know. Struts is
the major player, but there are other such. I honestly fail to see the
need for them.

I employ my own custom Javabeans quite frequently, but of taglibs I have
none, and I plan to keep it that way.

Luke


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.