You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jarnot Voytek Contr AU HQ/SC <Vo...@MAXWELL.AF.MIL> on 2003/05/07 15:24:01 UTC

RE:[OT] Using JSTL to check for empty attribute

try test="${empty corrections}"

--
Voytek Jarnot
Quidquid latine dictum sit, altum viditur.


> -----Original Message-----
> From: harm@informatiefabriek.nl [mailto:harm@informatiefabriek.nl]
> Sent: Wednesday, May 07, 2003 8:20 AM
> To: struts-user@jakarta.apache.org
> Subject: Using JSTL to check for empty attribute
> 
> 
> Hi all,
> 
> I used to check for empty attributes with the:
> 
> <logic:present name="variableToCheckFor">
> 
> syntax. I would like to do the same thing using JSTL but I'm 
> stuck here. 
> Can you guys help?
> 
> I use:
> 
> <c:choose>
>         <c:when test="${corrections == null} ">
>                 <!-- display some html -->
>         </c:when>
>         <c:otherwise>
>                 <!-- display some other html -->
>         </c:otherwise>
> </c:choose>
> 
> Although when I open the page the variable corrections is not 
> null, it 
> still displays the content in the 'otherwise' section.
> 
> 'corrections' by the way is a Collection.
> 
> Can you help?
> 
> Thanks,
> 
> Harm de Laat
> Informatiefabriek
> The Netherlands
> 
> 
> ---------------------------------------------------------------------
> 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


RE:[OT] Using JSTL to check for empty attribute

Posted by ha...@informatiefabriek.nl.
Sorry fellows... It works!
I just misunderstood the tag...

Thanks again,

Cheers,

Harm.




harm@informatiefabriek.nl 
05/07/2003 03:32 PM
Please respond to
"Struts Users Mailing List" <st...@jakarta.apache.org>


To
"Struts Users Mailing List" <st...@jakarta.apache.org>
cc

Subject
RE:[OT] Using JSTL to check for empty attribute






That does not work either.

I have an action that sets the attribute as follows:

Collection corrections = new Vector();
corrections.add(new Correction("cor1");
corrections.add(new Correction("cor2");
request.getSession().setAttribute("corrections", corrections);

Then it forwards the user to the JSP page as follows:

return mapping.findForward("corrections_overview");

I need to check if the attribute corrections has been set in this JSP 
page.

That does not work...

Any other suggestions?

Thanks,

Harm de Laat
Informatiefabriek
The Netherlands






Jarnot Voytek Contr AU HQ/SC <Vo...@MAXWELL.AF.MIL> 
05/07/2003 03:24 PM
Please respond to
"Struts Users Mailing List" <st...@jakarta.apache.org>


To
"'Struts Users Mailing List'" <st...@jakarta.apache.org>
cc

Subject
RE:[OT] Using JSTL to check for empty attribute






try test="${empty corrections}"

--
Voytek Jarnot
Quidquid latine dictum sit, altum viditur.


> -----Original Message-----
> From: harm@informatiefabriek.nl [mailto:harm@informatiefabriek.nl]
> Sent: Wednesday, May 07, 2003 8:20 AM
> To: struts-user@jakarta.apache.org
> Subject: Using JSTL to check for empty attribute
> 
> 
> Hi all,
> 
> I used to check for empty attributes with the:
> 
> <logic:present name="variableToCheckFor">
> 
> syntax. I would like to do the same thing using JSTL but I'm 
> stuck here. 
> Can you guys help?
> 
> I use:
> 
> <c:choose>
>         <c:when test="${corrections == null} ">
>                 <!-- display some html -->
>         </c:when>
>         <c:otherwise>
>                 <!-- display some other html -->
>         </c:otherwise>
> </c:choose>
> 
> Although when I open the page the variable corrections is not 
> null, it 
> still displays the content in the 'otherwise' section.
> 
> 'corrections' by the way is a Collection.
> 
> Can you help?
> 
> Thanks,
> 
> Harm de Laat
> Informatiefabriek
> The Netherlands
> 
> 
> ---------------------------------------------------------------------
> 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




---------------------------------------------------------------------
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


RE:[OT] Using JSTL to check for empty attribute

Posted by ha...@informatiefabriek.nl.
That does not work either.

I have an action that sets the attribute as follows:

Collection corrections = new Vector();
corrections.add(new Correction("cor1");
corrections.add(new Correction("cor2");
request.getSession().setAttribute("corrections", corrections);

Then it forwards the user to the JSP page as follows:

return mapping.findForward("corrections_overview");

I need to check if the attribute corrections has been set in this JSP 
page.

That does not work...

Any other suggestions?

Thanks,

Harm de Laat
Informatiefabriek
The Netherlands






Jarnot Voytek Contr AU HQ/SC <Vo...@MAXWELL.AF.MIL> 
05/07/2003 03:24 PM
Please respond to
"Struts Users Mailing List" <st...@jakarta.apache.org>


To
"'Struts Users Mailing List'" <st...@jakarta.apache.org>
cc

Subject
RE:[OT] Using JSTL to check for empty attribute






try test="${empty corrections}"

--
Voytek Jarnot
Quidquid latine dictum sit, altum viditur.


> -----Original Message-----
> From: harm@informatiefabriek.nl [mailto:harm@informatiefabriek.nl]
> Sent: Wednesday, May 07, 2003 8:20 AM
> To: struts-user@jakarta.apache.org
> Subject: Using JSTL to check for empty attribute
> 
> 
> Hi all,
> 
> I used to check for empty attributes with the:
> 
> <logic:present name="variableToCheckFor">
> 
> syntax. I would like to do the same thing using JSTL but I'm 
> stuck here. 
> Can you guys help?
> 
> I use:
> 
> <c:choose>
>         <c:when test="${corrections == null} ">
>                 <!-- display some html -->
>         </c:when>
>         <c:otherwise>
>                 <!-- display some other html -->
>         </c:otherwise>
> </c:choose>
> 
> Although when I open the page the variable corrections is not 
> null, it 
> still displays the content in the 'otherwise' section.
> 
> 'corrections' by the way is a Collection.
> 
> Can you help?
> 
> Thanks,
> 
> Harm de Laat
> Informatiefabriek
> The Netherlands
> 
> 
> ---------------------------------------------------------------------
> 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




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