Check Existance of Bean in Struts

G

google khan

Hi,
i am using Struts 1.3.5 and I want to do somthing like that

if bean present
do something
else
do somthing

i can use
<logic:present name="Xbean">
do something
</logic:present>
<logic:notPresent name="Xbean">
do else part
</logic:notPresent>

but this portion of code will check request object twice, i don't want
that

i just want to check that bean once and if it is presnt , i want to do
something else just do something else

and i want to use struts , please do not refer JSP (if
request.getparameter(Xbean).....)

thanks
 
M

Manish Pandit

If you are okay with using JSTL tags, this will help hit the request
once, and serve the purpose:

<c:choose>
<c:when test="${!empty Xbean}">
do something
</c:when>
<c:eek:therwise>
do something else
</c:eek:therwise>
</c:choose>

-cheers,
Manish
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top