Oops! Please ignore my earlier mail. It is working fine, I goofed up too early without looking at the error messages in detail!!
The logic that I mentioned below *is* indeed working as expected without me having to do any kind of casting or coersion. warm regards ajaneesh -----Original Message----- From: Ajaneesh Rajashekharaiah [mailto:[EMAIL PROTECTED] Sent: Friday, July 04, 2008 8:51 PM To: user@struts.apache.org Subject: Type Casting through OGNL expressions. Hi, 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 <TopLevel> <SecondLevel> <ThirdLevel> <SecondLevelMore> <ThirdLevel> 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.... xmlObject.secondLevel.thirdLevel xmlObject.secondLevelMore.thirdLevel 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. regards ajaneesh ======================================================================== ==================================================== Disclaimer: 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="http://www.techmahindra.com/Disclaimer.html">http://www.techmahind ra.com/Disclaimer.html</a> externally and <a href="http://tim.techmahindra.com/Disclaimer.html">http://tim.techmahind ra.com/Disclaimer.html</a> internally within Tech Mahindra. ======================================================================== ==================================================== ============================================================================================================================ Disclaimer: 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="http://www.techmahindra.com/Disclaimer.html">http://www.techmahindra.com/Disclaimer.html</a> externally and <a href="http://tim.techmahindra.com/Disclaimer.html">http://tim.techmahindra.com/Disclaimer.html</a> internally within Tech Mahindra. ============================================================================================================================ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]