AW: exception with automatic formbean population

"Bernhard Woehrlin" <[email protected]>
Newsgroups gmane.comp.java.strutscx.user
Organization IT.CappuccinoNet.com
Message-ID <000701c3d83b$3de19590$4b01a8c0@javaws>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.