Hello,
 
I am new to Struts 2, so please bear with me.
 
I am looking at implementing a custom StrutsTypeConverter.  I want it to
be a "global" converter (no just specific to an Action).  If I'm
understanding it correctly, to implement this I create an
xwork-conversion.properties file, and the format of this file is like
this:
 
com.domain.SomeCustomType=com.domain.SomeCustomTypeConverter
 
where SomeCustomTypeConverter implements StrutsTypeConverter.  First
question:  Is this correct?
 
Next question:  How well does this handle subclassing?  Here's what I
mean:
 
Suppose I have an abstract com.domain.SomeAbstractClass type that has
many subclasses, and it's these subclasses that I actually need to
convert.  I want to have an entry like this in
xwork-conversion.properties:
 
com.domain.SomeAbstractClass=com.domain.SomeAbstractClassConverter
 
Where SomeAbstractClassConverter is smart enough to convert any instance
of SomeAbstractClass.  For this to happen, the Class that is sent to the
convertFromString method must be the class of the actual
SomeAbstractClass subclass, not the SomeAbstractClass.  
 
Is this what happens at runtime?  Is the class that is sent to
convertFromString the actual class that is being converted, or the class
that is listed in the .properties file?  Will Struts2 use the
SomeAbstractClass converter for a subclass of SomeAbstractClass even if
it's not explicity defined in the .properties file?
 
Thank you!!
 
-Ryan
 
 
 
 

This e-mail message is being sent solely for use by the intended recipient(s) 
and may contain confidential information.  Any unauthorized review, use, 
disclosure or distribution is prohibited.  If you are not the intended 
recipient, please contact the sender by phone or reply by e-mail, delete the 
original message and destroy all copies. Thank you.

Reply via email to