struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ajaneesh Rajashekharaiah" <>
Subject Type Casting through OGNL expressions.
Date Fri, 04 Jul 2008 15:20:44 GMT

I want to do the following, would like to understand if it is possible
at all before proceeding any further.
basically i am working on generating dynamic screens based on Apache
XmlBeans generated classes.  
While the following is not exactly what i am doing, it will help drive
the idea home... 
i have a number of XSD files for which i generate XmlBeans binding
files.  All these classes are basically of type XmlObject.
Understandably, each class would have diffferent setters and getters
based on the XSD.  In my action class, i want to declare a property with
just the underlying interface (i.e.  XmlObject).  I am in a position to
generate the dynamic screen based on the XML schema... but how do i
populate those back to my XmlObject property?
for e.g.  Action class has 
XmlObject xmlObject;
public XmlObject getXmlObject() {
 // snip...
public void setXmlObject(XmlObject xmlObject) {
 // snip...
Suppose i am dealing with a XML with a structure such as 
Let us assume my schema based XmlObject classes will have the same names
as node names.  So TopLevel *is a* XmlObject.
I want to set values from a HTML form using a OGNL expression....
Obviously, OGNL runtime cannot find setSecondLevel() on xmlObject unless
it has a way of casting it to *TopLevel*
I have been researching a solution to this problem for a long time.,, I
found something on TypeConvertors, havent tried it yet and honestly not
able to tell if it is a solution to my problem :-)  
Can someone help me with this?  Am i asking for too much or is this
actually possible??  If it *is* possible, will it execute with
reasonable performance?
Any response will be greatly appreciated so that i can atleast take an
alternative approach immediately.





This message and the information contained herein is proprietary and confidential and subject
to the Tech Mahindra policy statement, you may review the policy at <a href=""></a>
externally and <a href=""></a>
internally within Tech Mahindra.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message