This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes I  need to set <s:property> value in the action class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "I  need to set <s:property> value in the action class" Watch "I  need to set <s:property> value in the action class" New topic
Author

I need to set <s:property> value in the action class

Prashant K. Singh
Greenhorn

Joined: May 11, 2009
Posts: 18
Hi dear,

what I am doing is that I have taken out all the products listed under product category and have displayed them in a jsp.

Now I want to click the product and display all the supplier that supply the product.

Anysuggestions how do i do that in struts 2.0

My jsp is as follows:



My Action class is as follows:


My Supplier.java is as follows:



Prashant Singh
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Use the product id as a parameter in the link to display product details.
Prashant K. Singh
Greenhorn

Joined: May 11, 2009
Posts: 18
Hi David,

could you please elaborate this. I dont know how to use the id as a parameter.

Thanks and regards,
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

There are a few ways to do it; here's two.All of these topics are covered in the Struts 2 documentation, which I'd recommend reading before getting too much further into your project. There are at least a couple more variations, but this should be enough to get you started.
Prashant K. Singh
Greenhorn

Joined: May 11, 2009
Posts: 18
Hi Dave,

I am able to reach the action class but the productId values is coming null ie the productID is not populating. Please check.

Here is my producthandled.jsp



Here is my Showpdtsuppliers.java



Here is my Suppliers.java

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Continuing on struts-user.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I need to set <s:property> value in the action class
 
Similar Threads
need to transfer productID from url to action class in struts 2
how to display database values in a table
missing return statement {
How to store values in session using struts 2 and then how to retrieve values in a jsp
how to display mysql table datas in jsp using struts2