Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Characters "&(." throws exception

Status
Not open for further replies.

ekn

Programmer
Jan 26, 2004
3
PH
hello! I have a struts application running that uses actionForm and nested tags. Whenever a user inputs the characters &quot;&(.&quot; in chronological order on a <nested:textarea>, an exception occurs after submit. I hope somebody can help me solve this.

the error message is as follows:

java.lang.IllegalArgumentException: Invalid mapped property '('
at org.apache.commons.beanutils.PropertyUtils.getMappedProperty(PropertyUtils.java:564)
at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:768)
at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:801)
at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:881)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1096)
at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:816)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1420)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:502)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:262)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:198)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2678)
 
I know very little about jsp and struts. I would use javascript to replace the & by a symbol(or my created word like symbol_and) other than (&, + ,%). After the text is submitted and reach server. When the text is to be displayed, the jsp will change my created word to the real symbol.
 
use unicode, for &, the equivalent char is &quot;\u0026&quot;. for (, it is &quot;\u0028&quot;. Hence given a string var, x:-

x = &quot;\u0026&quot; + &quot;\u0028&quot; //will give you &(

visit for the other characters.

~za~
You can't bring back a dead thread!
 
oppss. i forgot. so in your bean method, particularly set, you can use a switch statement to check for the input and convert them accordingly.

p/s: someone with refactoring experience might not agree with me using the switch statement ;) So if you use refactoring, you can find the right pattern to apply the idea. good luck

~za~
You can't bring back a dead thread!
 
i just wonder why struts cannot handle this? i thought struts does encoding.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top