You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by foward <fo...@gmail.com> on 2009/03/24 17:07:10 UTC

Re: ClassCastException com.dev.model.Form cannot be cast to java.lang.String

lukaz,

the method getForm() return a object Form where before with the respective
id is obtained and returned.
Yes I m reading a book struts in action, I don't know if you recomend me a
good one.

Regards


Lukasz Lenart wrote:
> 
> 2009/3/24 foward <fo...@gmail.com>:
>> <s:action name="createForm!getForm" id="action" namespace="default"/>
> 
> Method getForm() return object Form or String? Struts is expecting
> that action will return a String not an object. I think you should
> read some tutorial how to use Struts 2.
> 
> 
> Regards
> -- 
> Lukasz
> http://www.lenart.org.pl/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/ClassCastException-com.dev.model.Form-cannot-be-cast-to-java.lang.String-tp22682861p22683750.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: ClassCastException com.dev.model.Form cannot be cast to java.lang.String

Posted by Lukasz Lenart <lu...@googlemail.com>.
2009/3/24 foward <fo...@gmail.com>:
> the method getForm() return a object Form where before with the respective
> id is obtained and returned.

You put method getForm() in s:form as a action, which means such
method will be called by Struts 2 and the framework will expect a
String - result name, which you have to define in struts.xml.
You shouldn't return an object like Form. To do that, implement
ModelDriven interface and return your Form object from method
getModel() and in your jsp use ${name} instead ${form.name}

> Yes I m reading a book struts in action, I don't know if you recomend me a
> good one.

That is good one


Regards
-- 
Lukasz
http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org