You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Todor Sergueev Petkov <t....@basalmed.uio.no> on 2003/12/10 17:57:54 UTC

Incompatibility between STRUTS TAGS and JSTL TAGS

Hello everybody. I have a small problem that maybe someone has already 
had in the past.

In a jsp page I try to retrive request parameters thus ( STRUTS + 
Jakarta TAGLIBS ) :

<req:parameters id="loop">
Name: <bean:write  name="loop" property="name"/>
Value: <bean:write name="loop" property="value"/>
</req:parameters>

and this works fine...

When I try JSTL

<c:out value="${requestScope.source}"/>
<c:out value="${requestScope.animalId}"/>
<c:out value="${requestScope.injId}"/>

doesn't work...

The names of the the request parameters that should be there are correct...

Is there any masking between JSTL vars and STRUTS vars that someone is 
aware of?

Todor


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


Re: Incompatibility between STRUTS TAGS and JSTL TAGS

Posted by Christian Bollmeyer <ja...@christianbollmeyer.de>.
Am Mittwoch, 10. Dezember 2003 17:57 schrieb Todor Sergueev Petkov:

> When I try JSTL
>
> <c:out value="${requestScope.source}"/>
> <c:out value="${requestScope.animalId}"/>
> <c:out value="${requestScope.injId}"/>
>
> doesn't work...

The above code looks for *attributes* in request scope,
not parameters. To access parameters via JSTL, you
have to make use of the implicit EL variable (actually
a java.util.Map) named 'param', like this:

<c:out value="${param.source}"/>
<c:out value="${param.animalId}"/>
<c:out value="${param.injId}"/>

HTH,
-- Chris.

> The names of the the request parameters that should be there are
> correct...
>
> Is there any masking between JSTL vars and STRUTS vars that someone
> is aware of?
>
> Todor
>
>
> ---------------------------------------------------------------------
> 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: Incompatibility between STRUTS TAGS and JSTL TAGS

Posted by Kris Schneider <kr...@dotech.com>.
You seem to be confusing request parameters and request attributes (or
request-scoped variables). Try:

<c:out value="${param.source}"/>

JSTL gives you two ways (implicit objects) to get at request parameters:

param
a Map that maps parameter names to a single String parameter value (obtained by
calling ServletRequest.getParameter(String name))

paramValues
a Map that maps parameter names to a String[] of all values for that parameter
(obtained by calling ServletRequest.getParameterValues(String name))

Quoting Todor Sergueev Petkov <t....@basalmed.uio.no>:

> Hello everybody. I have a small problem that maybe someone has already 
> had in the past.
> 
> In a jsp page I try to retrive request parameters thus ( STRUTS + 
> Jakarta TAGLIBS ) :
> 
> <req:parameters id="loop">
> Name: <bean:write  name="loop" property="name"/>
> Value: <bean:write name="loop" property="value"/>
> </req:parameters>
> 
> and this works fine...
> 
> When I try JSTL
> 
> <c:out value="${requestScope.source}"/>
> <c:out value="${requestScope.animalId}"/>
> <c:out value="${requestScope.injId}"/>
> 
> doesn't work...
> 
> The names of the the request parameters that should be there are correct...
> 
> Is there any masking between JSTL vars and STRUTS vars that someone is 
> aware of?
> 
> Todor

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

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