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:[EMAIL PROTECTED]] 
Sent: Sunday, February 02, 2003 3:35 PM
To: [EMAIL PROTECTED]
Subject: Re: logic-el and the request object

>>>>> "Jeff" == Jeff Born <[EMAIL PROTECTED]> 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++
[EMAIL PROTECTED]   ; SCJP; SCWCD




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to