You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pankaj Gupta <pa...@hsc.com> on 2006/07/14 09:28:57 UTC

Problem using logic:present tag

Hi All,

I am passing parameters to my JSP like:
<forward name="successActive" path="/hello.jsp?isActive=true" 
contextRelative="false"/>

and reading the parameter using logic:present tag which is not working:
<logic:present name="isActive">      
   < bean:message key = "activeTitle"/>
  </logic:present>


However if I do the same thing using scriptlets:
<% if(request.getParameter("isActive") != null
            && request.getParameter("isActive").equals("true") )
             %>
   < bean:message key = "activeTitle"/>

It works well. Please suggest what I am doing wrong.

regards,
Pankaj

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


Re: Problem using logic:present tag

Posted by Laurie Harper <la...@holoweb.net>.
Pankaj Gupta wrote:
> Hi All,
> 
> I am passing parameters to my JSP like:
> <forward name="successActive" path="/hello.jsp?isActive=true" 
> contextRelative="false"/>
> 
> and reading the parameter using logic:present tag which is not working:
> <logic:present name="isActive">        < bean:message key = "activeTitle"/>
>  </logic:present>
> 
> 
> However if I do the same thing using scriptlets:
> <% if(request.getParameter("isActive") != null
>            && request.getParameter("isActive").equals("true") )
>             %>
>   < bean:message key = "activeTitle"/>
> 
> It works well. Please suggest what I am doing wrong.
> 
> regards,
> Pankaj

Per the logic:present tag documentation [1], the 'name' attribute checks 
for a bean in some scope with the given name. You're trying to check for 
a request parameter, so you should be using the 'parameter' attribute 
instead of 'name'.

L.

[1] http://struts.apache.org/1.2.x/userGuide/struts-logic.html#present


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