Re: exception with automatic formbean population
"Emmanuel Cohen" <[email protected]>
| Newsgroups | gmane.comp.java.strutscx.user |
|---|---|
| Message-ID | <001e01c3d849$e0c7f980$2aacfcc1@ordi> |
Thank you for your prompt answer, Bernhard. It seems that in strutscx-demo.war, your infoformbean is static. By using Map values, my formbean is dynamic (I can populate dynamically my bean with any form -dynamically created with xsl and fields names gotten on the fly -). The only fields and methods in my formbean are : private final Map values = new HashMap(); public void setValue(String key, Object value); public Object getValue(String key); which is enough to retrieve all fields names and values in the Map. I failed to see how I could replace this mechanism. Would you explain me how it works without Map in the case of strutscx ? Thank you very much, Emmanuel ----- Original Message ----- From: "Bernhard Woehrlin" <[email protected]> To: "'Emmanuel'" <[email protected]>; <[email protected]> Sent: Sunday, January 11, 2004 1:05 PM Subject: AW: [Strutscx-user] exception with automatic formbean population Hi Emmanuel, The reason of the error is: XML names cannot contain the character "(". One solution would be to replace the Map with a List. Check out the strutscx-demo.war for an respective example. - Maybe there are other solutions, too. But keep in mind: StrutsCXStandardDocumentBuilder will try to make XML elements out of the Request's parameter names. Hope this is of help for you. Regards, Berny -----Ursprüngliche Nachricht----- Von: [email protected] [mailto:[email protected]] Im Auftrag von Emmanuel Gesendet: Samstag, 10. Januar 2004 22:28 An: [email protected] Betreff: [Strutscx-user] exception with automatic formbean population Hi All, I use a formbean that retrieves information passed in a form, like this : public class InfoFormBean extends StrutsCXValidatorForm { ... private final Map values = new HashMap(); public void setValue(String key, Object value) { logger.debug("key:"+key); values.put(key, value); } public Object getValue(String key) { return values.get(key); } ... } ##and my form looks like : <form ...> <input name="value(key1)" type="text" /> <input name="value(prop1)" type="text" /> ... </form> ##The formbean is populated alright. The associated action is called and execute is code also. ##But after the action executes its forward to another page, I get the following exception : 2004-01-10 22:04:02,158 DEBUG - [StrutsCXStandardDocumentBuilder] CONSTRUCT request Parameter: action = UPDATE 2004-01-10 22:04:02,158 DEBUG - [StrutsCXStandardDocumentBuilder] CONSTRUCT request Parameter: value(key1) = townname MonitorFilter::Error: The name "value(key2)" is not legal for JDOM/XML elements: XML names cannot contain the character "(". MonitorFilter::A web application object caused an exception MonitorFilter::org.jdom.IllegalNameException: The name "value(key2)" is not legal for JDOM/XML elements: XML names cannot contain the character "(". at org.jdom.Element.setName(Element.java:217) at org.jdom.Element.<init>(Element.java:145) at org.jdom.Element.<init>(Element.java:158) etc.... ##I tried to reset the formbean before doing the forward, but the error is exactly the same. I do not need this information (value(key2)) anymore at that time. How could I get rid of that ? Thanks in advance. Emmanuel --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.555 / Virus Database: 347 - Release Date: 23/12/2003 ------------------------------------------------------- This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html