This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts tag - logic:present attribute? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts tag - logic:present attribute?" Watch "Struts tag - logic:present attribute?" New topic
Author

Struts tag - logic:present attribute?

Jessica Doe
Ranch Hand

Joined: Dec 11, 2003
Posts: 32
Hi,
I am trying to test for the presence of a request attribute called "PCAT".
This works:
if (request.getAttribute ("PCAT") != null)
This doesn't work:
<logic:present parameter="PCAT">
</logic:present>
What Struts logic tag would work?
Thanks,
Jessie
[ December 27, 2003: Message edited by: Jessica Doe ]

Jessica Doe<br /> <br />C# Online.NET<br /> <a href="http://wiki.csharp-online.net/" target="_blank" rel="nofollow">http://wiki.csharp-online.net/</a>
Rick Hightower
Author
Ranch Hand

Joined: Feb 20, 2002
Posts: 350
You want:

The above checks to see if the request attribute PCAT is present.
If you leave off the scope, and just use the name it will search from page scope to aplication scope (inner most to outer most scope).
What you wrote:

Would check to see if a request parameter called PCAT was present.


Rick Hightower is CTO of Mammatus which focuses on Cloud Computing, EC2, etc. Rick is invovled in Java CDI and Java EE as well. linkedin,twitter,blog
Jessica Doe
Ranch Hand

Joined: Dec 11, 2003
Posts: 32
Thanks, Rick!
Rick Hightower
Author
Ranch Hand

Joined: Feb 20, 2002
Posts: 350
no problem.
 
wood burning stoves
 
subject: Struts tag - logic:present attribute?