struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Born" <jb...@charter.net>
Subject Re: logic-el and the request object
Date Sun, 02 Feb 2003 22:37:33 GMT
I wasn't looking in the JSTL spec, once I looked there I found an
example I could extrapolate from.  Thanks for pointing me in the right
direction David.  BTW your example was exactly what I needed also, so
thanks again.

jb


-----Original Message-----
From: David M. Karr [mailto:dmkarr@earthlink.net] 
Sent: Sunday, February 02, 2003 3:35 PM
To: struts-user@jakarta.apache.org
Subject: Re: logic-el and the request object

>>>>> "Jeff" == Jeff Born <jborn@charter.net> writes:

    Jeff> I have been unsuccessfully trying to figure out how to do
something like
    Jeff> the following:
 
    Jeff> <logic-el:present name="request" parameter="contextPath"> do
something
    Jeff> </logic-el:present>
 
    Jeff> if this possible? Am I going about it all wrong?  I really
want to check
    Jeff> for the existence of getParameter("body") and if the body tag
exists do
    Jeff> something.  After playing with it I couldn't even get the
other example
    Jeff> to work right, and pretty much have fell back to the following
code?
 
    Jeff> <% if ((String tempBody = request.getParameter("body")) ==
null) { %>
    Jeff> do something
    Jeff> <% } else { %>
    Jeff> do something else
    Jeff> <% } %>
 
    Jeff> How do I do this!!!?!?
 
If you're using "logic-el", then you might as well use the JSTL, which
is more
suited for this.  Note that your sample code differs slightly from what
you
said in english, but this should be close enough for you.  If you want
to
reverse the test, change "empty" to "not empty".  Note that this code
hasn't
been compiled.

  <c:choose>
   <c:when test="${empty param.body}">
    Do something.
   </c:when>
   <c:otherwise>
    Do something else.
   </c:otherwise>
  </c:choose>

I suggest you read the JSTL specification.

-- 
===================================================================
David M. Karr          ; Java/J2EE/XML/Unix/C++
dmkarr@earthlink.net   ; SCJP; SCWCD




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message