Setter method in form bean corresponding to text field in JSP

V

Vijay

hi all,

In my JSP, I am having a text field like this

<input type="text" name="data(id)" />

Please note, that I am not using <html:text> tag. Can you tell me what
should be the corresponding setter nethod signature in the bean.
I have tried
public void setData(String key, String value) and
public void setData(String key, Object value)

but both of them are not working.
I have also noted that if I use <html:text> tag in the same mannar,
then my {Object value} setter method gets called.

Thanks for any help,
 
A

Arnaud Berger

Hi,

A usual setter would look like :

public void setData(String value)

, I think.

Also, do you have something like :
<jsp:setProperty name="numguess" property="*"/>
or
<jsp:setProperty name="numguess" property="data"/>

in your JSP ?

Regards,

Arnaud
 
A

Arnaud Berger

Oops,

the "numguess" should be the id you have given to the instance with:

<jsp:useBean id="theId" class="yourClass" scope="session or whatever"/>

Anyone will have recognized an example from Tomcat...;)

Regards,

Arnaud
 
V

Vijay

hi,

I have debugged through the struts and commons-beanutils code and found
that the getters and setters that I am using are not returning
MappedPropertyDescriptor instance. Instead, they are only returning
regular PropertyDescriptor.

Arnaud: This is a mapped property that I am using, not a regular
property. So, both the methods require a key.

Thanks,
 
V

Vijay

Sorry folks, I was making a mistake in my form. I had mistakenly put an
additional setter of this signature
public Map getData(). After removing this, the problem has got solved.

This was interfering with the usual behavior.

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top