You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Phani <ph...@yahoo.com> on 2005/06/22 20:29:58 UTC
trouble passing multiple parameters using
Here is my code in the JSP page:
<bean:define id="param1"
name="stockingStoreSalesReviewForm"
property="storeNumber"/>
<bean:define id="param2"
name="stockingStoreSalesReviewForm"
property="storeName"/>
<%
java.util.HashMap params = new java.util.HashMap();
params.put("storeNo",param1);
params.put("storeName",param2);
pageContext.setAttribute("storeInfo", params);
%>
<html:link action="/partDetailView"
paramName="storeInfo" scope="page"> Click Here
</html:link>
In the Action class:
String storeNumber =
(String)request.getParameter("storeNo");
I am getting null in the storeNumber.
What went wrong!! Any help appreciated...
Thanks.
____________________________________________________
Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football
http://football.fantasysports.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: trouble passing multiple parameters using
Posted by Roberto <di...@yahoo.it>.
Phani wrote:
>In the Action class:
>
>String storeNumber =
>(String)request.getParameter("storeNo");
>
>
>I am getting null in the storeNumber.
>
>What went wrong!! Any help appreciated...
>
>
But you give at the Action a java.util.HashMap not a String and its
name is "storeInfo" not "storeNo".
am I mistaking?
Roberto
___________________________________
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
http://mail.yahoo.it
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: trouble passing multiple parameters using
Posted by Laurie Harper <la...@holoweb.net>.
Are you sure stockingStoreSalesReviewForm.getStoreNumber() is returning valid data?
L.
Phani wrote:
> Here is my code in the JSP page:
>
> <bean:define id="param1"
> name="stockingStoreSalesReviewForm"
> property="storeNumber"/>
>
> <bean:define id="param2"
> name="stockingStoreSalesReviewForm"
> property="storeName"/>
>
> <%
> java.util.HashMap params = new java.util.HashMap();
> params.put("storeNo",param1);
> params.put("storeName",param2);
> pageContext.setAttribute("storeInfo", params);
> %>
>
> <html:link action="/partDetailView"
> paramName="storeInfo" scope="page"> Click Here
> </html:link>
>
>
> In the Action class:
>
> String storeNumber =
> (String)request.getParameter("storeNo");
>
>
> I am getting null in the storeNumber.
>
> What went wrong!! Any help appreciated...
>
>
> Thanks.
>
>
>
> ____________________________________________________
> Yahoo! Sports
> Rekindle the Rivalries. Sign up for Fantasy Football
> http://football.fantasysports.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: trouble passing multiple parameters using
Posted by Joe Germuska <Jo...@Germuska.com>.
For the relatively low cost of specifying your servlet mapping, you
can use the JSTL c:url/c:param tags and achieve all of this much more
concisely:
<c:url var="myUrl" value="/partDetailView.do">
<c:param name="storeNo" value="${stockingStoreSalesReviewForm.storeNumber}" />
<c:param name="storeName" value="${stockingStoreSalesReviewForm.storeName}" />
</c:url>
<a href="<c:out value="${myUrl}" />">Click Here</a>
There's an enhancement request filed to add "c:param" type
functionality to <html:link>, and I think I even assigned it to
myself, but to be honest, I am satisfied with the JSTL alternative
and haven't had (and don't expect to have) time to add an
"html:param" tag to the Struts JSTL just for the general good.
All that html:link provides in the specific case below is a lookup
function which (a) verifies that you have a valid action path at JSP
compile time and (b) gives you the freedom to change your mappings
from "*.do" to "*.foo" or anything else -- a freedom which is
probably compromised in most apps by the need to have external links
into the application, so which doesn't seem all that valuable to me.
Joe
At 11:10 AM +0100 6/23/05, Bob Arnott wrote:
>Phani wrote:
>> Here is my code in the JSP page:
>>
> > <bean:define id="param1" name="stockingStoreSalesReviewForm"
>property="storeNumber"/>
>>
> > <bean:define id="param2" name="stockingStoreSalesReviewForm"
>property="storeName"/>
>>
>> <%
>> java.util.HashMap params = new java.util.HashMap();
>> params.put("storeNo",param1);
> > params.put("storeName",param2);
>> pageContext.setAttribute("storeInfo", params);
>> %>
>>
>> <html:link action="/partDetailView"
>> paramName="storeInfo" scope="page"> Click Here
>> </html:link>
>
>You want to specify the Map under the attribute "name", not "paramName", so:
>
><html:link action="/partDetailView" name="storeInfo"
>scope="page">Click Here</html:link>
>
>See -
>
>http://struts.apache.org/userGuide/struts-html.html#link#
>
>Cheers,
>
>--
>Bob Arnott
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
--
Joe Germuska
Joe@Germuska.com
http://blog.germuska.com
"Narrow minds are weapons made for mass destruction" -The Ex
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: trouble passing multiple parameters using
Posted by Bob Arnott <bo...@aungate.com>.
Phani wrote:
> Here is my code in the JSP page:
>
> <bean:define id="param1" name="stockingStoreSalesReviewForm" property="storeNumber"/>
>
> <bean:define id="param2" name="stockingStoreSalesReviewForm" property="storeName"/>
>
> <%
> java.util.HashMap params = new java.util.HashMap();
> params.put("storeNo",param1);
> params.put("storeName",param2);
> pageContext.setAttribute("storeInfo", params);
> %>
>
> <html:link action="/partDetailView"
> paramName="storeInfo" scope="page"> Click Here
> </html:link>
You want to specify the Map under the attribute "name", not "paramName", so:
<html:link action="/partDetailView" name="storeInfo" scope="page">Click Here</html:link>
See -
http://struts.apache.org/userGuide/struts-html.html#link#
Cheers,
--
Bob Arnott
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org