aspose file tools*
The moose likes Struts and the fly likes small doubt in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "small doubt in struts" Watch "small doubt in struts" New topic
Author

small doubt in struts

Praveen palukuri
Ranch Hand

Joined: Feb 10, 2005
Posts: 65
hi,
this is praveen, i'm new to struts.i've one problem.
i'm developing supermarket appl in struts.
when the user purchases some items then we should deduct those from the database.
Here in one page i'm taking his orders and in the next page i want to display the orders which r given by the user.

i'm able to display selected item details from database, but i'm unable to display the given order value.but, i'm getting those in the action class and i'm calculating total cost for all the selected items, but i don't know how to send those to next page.

for this i tried something : i created new javabean for that try to display in the next page, but it raised exception:
"No getter method for property givenqty of bean givenvalform"

here is the code:

Bean:
public class GivenValForm {

protected String givenqty;

//set the given quantity
public void setGivenqty(String givenqty) {
this.givenqty = givenqty;
}

Action class:

//creating object to hold the quantities given by user
ArrayList orderedquantity = new ArrayList();
GivenValForm givenvalform = null;
System.out.println("In execute method of selected item action");
// creating string array to hold checked items id
String[] selectedlist =((SelectedItemForm)form).getCheckeditem();
int checklength = selectedlist.length ;
//creating an array to hold orders given by user
String[] orderedval = new String[checklength];
//creating an array to hold all order values(includes which r not selected to)
String[] orderedqty = ((SelectedItemForm)form).getOrderedqty();
String val = "";


// loop until all the given orders r stored in orderval
for(int i=0; i < checklength; i++)
{
String num = selectedlist[i];
System.out.println(orderedqty[(Integer.parseInt(num)-1)]);
val = orderedqty[(Integer.parseInt(num)-1)];
int oq = Integer.parseInt(val);
System.out.println("xxxx:"+val);

orderedval[i] = val ;
//creating an GivenValForm object
givenvalform = new GivenValForm();
//setting the given order to bean object
givenvalform.setGivenqty(val);
//storing the given order in the array list.
orderedquantity.add(val);

}
System.out.println("given quantities:"+ orderedquantity);
request.setAttribute("orderedquantity",orderedquantity);

// get the given quantity
public String getGivenqty() {
return this.givenqty;
}
} // end of GivenValForm {}


jsp:

<logic:iterate id="givenvalform" name="orderedquantity">
<bean:write name="givenvalform" property="givenqty" />
</logic:iterate>

pls send the response as early as possible. tommorow i've to submit this work.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: small doubt in struts