This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I'm having some trouble in getting this to work, so any help including pointers to documentation would be really appreciated.
When I submit specific characters (like ampersand, quote)from my JSP page to the server, I get them translated to HTML entities automatically. I suppose this is being done automatically by Struts, between the JSP form submission and the form population.
This is what I get:
Submit "&", the ActionForm property shows "&". Submit ">", the ActionForm property shows ">gt;".
This is a problem considering we have fixed-length database columns. Thus, client-side string sized 1 is translated to a server-side string sized 4, 5 or 6, bringing obvious storage problems.
Is there any way to tell Struts to put the strings exacly the way they were typed in the page form? Otherwise, I'd need to manually convert back those HTML entities to ASCII characters. There is a similar feature in the <bean:write> tag, the attribute "filter", but this is only for output.
Again, any help on this would be very appreciated.
Thanks and regards, Diego.
[ November 09, 2005: Message edited by: Diego Camargo Prates ] [ November 09, 2005: Message edited by: Diego Camargo Prates ]
The HTML entities are used in the generated HTML, but are they actually used inside the Java code? Inside your action class, try doing a System.out.println() of the form field in question.
Diego Camargo Prates
Joined: Nov 09, 2005
Yes, the Java String inside the action form holds the value as HTML entity. I mean, the value inside the property is "&", not "&" as desired. [ November 11, 2005: Message edited by: Diego Camargo Prates ]