• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

small doubt in struts

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 didn't say it. I'm just telling you what this tiny ad said.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic