Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

No getter method for property givenqty of bean givenvalform

 
Praveen palukuri
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i'm new to struts, i have the following problem when runniny my small appl
"No getter method for property givenqty of bean givenvalform"
it seems everything is correct to me, but i don't know where the problem.
the code follows:

"GivenValForm Bean"
public class GivenValForm {

protected String givenqty;

public void setGivenqty(String givenqty) {
this.givenqty = givenqty;
}
public String getGivenqty() {
return this.givenqty;
}
}

//Action class
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 = "";

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);

it store the values in arraylist & displaying.
but when displaying in browser it throws the exception.
the jsp page as follows:

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

pls send the solution for this.it's urgent to me.
bye...
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see any code in your action class that places the ActionForm into the request. You need a statement like:
request.setAttribute("givenvalForm", givenvalForm);

That alone will not fix the problem, though. Check your struts-config.xml to see that you have defined givenvalForm as a form name, and that your action is configured to use givenvalForm.

If you don't know if your configuration is correct or not, show the relevant portions in your next post, and we'll help you with it.

It would also be helpful to see the <html:form> tag in your jsp.
[ March 14, 2005: Message edited by: Merrill Higginson ]
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your Action class's posted code does not show the declaration for orderedquantity, but by your call of orderedquantity.add(val); I assume that it is a Collection of Strings (val is a String).

So in your jsp, the givenvalform you are referencing is not a form at all but is a String object, and String does not have a getGivenqty() method!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic