Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Struts
Search Coderanch
Advance search
Google search
Register / Login
This week's book giveaway is in the
Java in General
forum.
We're giving away four copies of
Helidon Revealed: A Practical Guide to Oracle’s Microservices Framework
and have Michael Redlich on-line!
See
this thread
for details.
Win a copy of
Helidon Revealed: A Practical Guide to Oracle’s Microservices Framework
this week in the
Java in General
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Liutauras Vilda
Ron McLeod
Sheriffs:
Jeanne Boyarsky
Devaka Cooray
Paul Clapham
Saloon Keepers:
Scott Selikoff
Tim Holloway
Piet Souris
Mikalai Zaikin
Frits Walraven
Bartenders:
Stephan van Hulst
Carey Brown
Forum:
Struts
How to pass an object through html:link
Raaja Gotluru
Ranch Hand
Posts: 118
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
I am using
struts
1.3. And i have a situation where I want to pass a bean object through html:link.
My code is:
<logic:iterate id="po" name="poList"> <tr> <td align="center"><bean:write name="po" property="ponumber" /> </td> <td align="center"><bean:write name="po" property="category" /></td> <td align="center"><bean:write name="po" property="itemname" /> </td> <td align="center"><bean:write name="po" property="description" /> </td> <td align="center"><bean:write name="po" property="uomaterial" /> </td> <td align="center"><bean:write name="po" property="quantity" /> </td> <td align="center"><bean:write name="po" property="rate" /></td> <td align="center"><bean:write name="po" property="totalamt" /></td> <td align="center"><bean:write name="po" property="podate" /></td> <td align="center"><bean:write name="po" property="vendorName" /> </td> <% java.util.HashMap<Object,Object> params = new java.util.HashMap<Object,Object>(); params.put(po, po); session.setAttribute("parameters", params); %> <td align="center"><html:link action="/modifyPo.do" paramId="po" paramName="po">Modify</html:link></td> <bean:define id="poid" name="po" property="poid" /> <td align="center"><html:link action="/deletePo.do" paramId="poid" paramName="poid">Delete</html:link></td> <!-- or --> <!-- <td align="center"><html:link action="/deletePo.do" name="parameters">Delete</html:link></td>--> </tr> </logic:iterate>
Action:
HttpSession session = request.getSession(); // java.util.HashMap<String, PurchaseOrderBean> hm =(java.util.HashMap<String, PurchaseOrderBean>) session.getAttribute("parameters"); // java.util.Map<String, PurchaseOrderBean> poBean = (java.util.Map)request.getParameter("parameters"); DynaValidatorForm frm = (DynaValidatorForm)form; // PurchaseOrderBean pOrder = (PurchaseOrderBean)hm.get("po"); PurchaseOrderBean pOrder = (PurchaseOrderBean)request.getAttribute("po"); BeanUtils.copyProperties(frm, pOrder);
If I use HashMap to pass the bean I am getting only the latest one.
If I use paramId and paramName then I am getting null values.
How to solve it.
Thanking you.
--regards,
raaja.g
Chandan Sarma
Greenhorn
Posts: 14
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
i think you need pass it with
pagecontext
.try it instead of session
sunglasses are a type of coolness prosthetic. Check out the sunglasses on this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Struts and Hibernate how to display in jsp file
How to hide url: in struts
html:link in logic:iterate
Hidden variable
How to add parameters to the action dynamically
More...