gigaZhang / struts2-jquery

Automatically exported from code.google.com/p/struts2-jquery
0 stars 0 forks source link

Problem for sj:autocompleter #953

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
struts 2.3.8 + struts2-jquery-3.5.1

JSP code(a form for user information):
<sj:autocompleter
    parentTheme="bootstrap"
    label="Origin"
    name="user.origin"
    list="%{origins}"
    loadMinimumCount="1"
/>

The information can be displayed well, with autocomplete. However, it raises 
exception when submitting:
WARNING: Error setting expression 'user.ethnicity_widget' with value 
'[Ljava.lang.String;@282d0fef'
ognl.NoSuchPropertyException: 
cn.edu.tsinghua.thss.redassist.dao.UserInfo.ethnicity_widget

*Reason*: in your 
code(com/jgeppert/struts2/jquery/components/Autocompleter.java), you have 
    String nameValue = (String) getParameters().get("name");
    addParameter("name", nameValue + "_widget");

which means there is another textfield called "user.origin_widget". This is 
also submitted to server along with the textfield "user.origin".
OGNL tries to save the value and failed.

(For normal variable names such as "user_origin", OGNL will ignore 
"user_origin_widget" which is not existed in the action)
I fix this by adding an empty "setOrigin_widget" in user...

Also, it is strange for me that "user.origin_widget" holds the real value while 
"user.origin" holds the value from the list only

Original issue reported on code.google.com by qiankang...@gmail.com on 24 Feb 2013 at 7:19

GoogleCodeExporter commented 9 years ago
sorry for the typo..。

WARNING: Error setting expression 'user.origin_widget' with value 
'[Ljava.lang.String;@282d0fef'
ognl.NoSuchPropertyException: 
cn.edu.tsinghua.thss.redassist.dao.UserInfo.origin_widget

(I just have two autocompleter called origin/ethnicity...they behavior in the 
same exception...)

Original comment by qiankang...@gmail.com on 24 Feb 2013 at 7:28