commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Durham David Cntr 805CSS/SCBE" <David.Durh...@scott.af.mil>
Subject [Digester] SetPropertiesRule
Date Fri, 14 Feb 2003 21:57:28 GMT
Having a problem with digester.setProperties(String).  

I have the following xml doc:

<root>
    <element xOffset="squadron"/>
</root>


The property does not get set in the bean unless the "x" in xOffset is capitalized, i.e.,
"XOffset" which doesn't seem right.

Is this a bug?



Following code to retrieve the data in a jsp:

    Digester digester = new Digester();
    digester.addObjectCreate("root/element", XOffsetBean.class);

    digester.addSetProperties("root/element");

    XOffsetBean x = (XOffsetBean)digester.parse(getServletContext().getRealPath("WEB-INF/config.xml"));
    
    out.print("XOffset is: " + x.getXOffset());



XOffsetBean code:

    private String xOffset = null;
    
    /** Creates a new instance of XOffsetBean */
    public XOffsetBean() {
    }
    
    /** Getter for property xOffset.
     * @return Value of property xOffset.
     *
     */
    public java.lang.String getXOffset() {
        return xOffset;
    }
    
    /** Setter for property xOffset.
     * @param xOffset New value of property xOffset.
     *
     */
    public void setXOffset(java.lang.String xOffset) {
        this.xOffset = xOffset;
    }

Thanks,


Dave











David Durham
NCI Information Systems
Scott AFB, AMC SCBE
618.256.5264

Mime
View raw message