wood burning stoves 2.0*
The moose likes Struts and the fly likes select - what to put in property 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 "select - what to put in property" Watch "select - what to put in property" New topic
Author

select - what to put in property

AnilPrakash Raju
Ranch Hand

Joined: Jul 26, 2004
Posts: 137
Hi,
I was wondering what to put in the select - property field.

In my bean a got a vector which has a vector of strings.

eg. periodEndVec.add("period1");
periodEndVec.add("period2");
periodEndVec.add("period1");

then add to my bean - statBean.setPeriodEndVec(periodEndVec);

so in my jsp i got

<html:select property="???">
<html ptions name="statBean" property="periodEndingVec" />
</html:select>

But I don't know what to put in the select property?

Thanks

Anil
Shankar Narayana
Ranch Hand

Joined: Jan 08, 2003
Posts: 134
Hi Anil,

You will get only the selected value from the dropdown when you submit the jsp page, and for that value you define a variable like "selectId" in your actionForm with the set/get methods and the corressponding property value will be "selectId".

Hope you got my point


"Failure is not when you fall down; its only when you fail to get up again."
AnilPrakash Raju
Ranch Hand

Joined: Jul 26, 2004
Posts: 137
Hi Shankar,

I tried what you suggested, but i am getting an error

No getter method available for property periodEndingId for bean under name org.apache.struts.taglib.html.BEAN

Any other suggestions?

thanks

Anil
Shankar Narayana
Ranch Hand

Joined: Jan 08, 2003
Posts: 134
Hi Anil,

I hope you have a variable named "periodEndingId" in your ActionForm and the corressponding methods might be


in your jsp you define the select tag as
<html:select property="periodEndingId" ...../>

check out the above things with your stuff, if everthing is as above with case sensitivity of the variables, then it shud work.

cheers..
AnilPrakash Raju
Ranch Hand

Joined: Jul 26, 2004
Posts: 137
Thanks Shankar,

I had put the get and set methods in the wrong place.

thank you very much.

Anil
 
 
subject: select - what to put in property
 
Similar Threads
struts select and options
Struts Multiselect to Hidden Field
optionsCollection syntax trouble
Can struts repopulate collection from html:select upon submit?
default value in select tag - - optionsCollection