RE: trouble passing multiple parameters using html:link
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=pageClick Here/html:link See - http://struts.apache.org/userGuide/struts-html.html#link# Cheers, -- Bob Arnott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: trouble passing multiple parameters using html:link
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=pageClick Here/html:link See - http://struts.apache.org/userGuide/struts-html.html#link# Cheers, -- Bob Arnott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: trouble passing multiple parameters using html:link
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: trouble passing multiple parameters using html:link
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: trouble passing multiple parameters using html:link
Try it step by step. Before passing a map, pass the values hardcoded: html:link action=/partDetailView?storeNo=123storeName=TheStoreClick Here/html:link And make sure that works. If it does, put storeNo and storeName into the storeInfo bean (you dont have to use scriptlets): jsp:useBean id=storeInfo class=java.util.HashMap c:set target=storeInfo property=storeNo value=123 / c:set target=storeInfo property=storeName value=TheStore / And test again (I probably have an error somewhere so make sure to check the syntax). Regards, Abdullah -Original Message- From: Phani [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 22, 2005 1:30 PM To: struts-user@jakarta.apache.org Subject: trouble passing multiple parameters using html:link 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]