• Post Reply Bookmark Topic Watch Topic
  • New Topic

small doubt in struts  RSS feed

Praveen palukuri
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

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];
val = orderedqty[(Integer.parseInt(num)-1)];
int oq = Integer.parseInt(val);

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

System.out.println("given quantities:"+ orderedquantity);

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


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

pls send the response as early as possible. tommorow i've to submit this work.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!