habibhassani
habibhassani

Reputation: 506

struts2 : Invalid field value for field?

<s:iterator value="company.locations"  status="s" ><br>
<s:hidden name="company.locations[%{#s.index}].position.longitude" value="%{position.longitude}" ></s:hidden>
.....

i get position from google map, when i send them to struts action, they work fine as long as they are a positive numbers. otherwise (negative number) it give me this error:

Invalid field value for field "company.locations[0].position.longitude" in the

<s:fielderror />
 

the latitude and longitude are double

class graph:

company > List< Location >

Location > Position(latitude, longitude)

<s:hidden name="company.locations[%{#s.index}].position.longitude" value="%{position.longitude}" ></s:hidden>

i don't use validation for this fields i redefined validate method only for redirection purpose, no validation staff in it.

what could be the problem, help me please?

Upvotes: 2

Views: 6461

Answers (3)

rgb130
rgb130

Reputation: 100

There is another reason this can happen. I was a little sloppy and had two setters like this...


    public String myField="";
    public void setMyField(String value) {
      myField=value;
    }

    public SomeOtherObject someOtherValue;
    public void setMyField(SomeOtherObject value) {
      someOtherValue=value;
    }

... which invalidated myField (i.e. the response was "Invalid field value for field myField").

Upvotes: 2

habibhassani
habibhassani

Reputation: 506

i have used a newer struts libraries, and this solved my problem.

Upvotes: 0

krunal chavda
krunal chavda

Reputation: 11

you need to make one youractionclassname.properties file which is from youractionclassname.java in same package.and add properties file to "invalid.fieldvalue.*=*", then it resolves.

Upvotes: 1

Related Questions