struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pedro Salgado <salgado...@04web.com>
Subject Re: Please Help - ClassCastException
Date Sun, 04 Jan 2004 03:33:36 GMT

  On your struts config file check if the form bean for StoreMessage action
is of type pkg.pkg.PostForm and if the action name is pointing to the
correct form bean... It also seems to be missing the import of the PostForm
on your action class.

Pedro Salgado

On 04/01/2004 03:22, "Caroline Jen" <jiapei_jen@yahoo.com> wrote:

> The statement shown below encountered a
> ClassCastException:
> 
>     PostForm postForm = ( PostForm )form;
> 
> I cannot figure out the reason.  Please help.
> 
> Allow me to show more code of the class where the
> exception occurred:
> 
> ...
> 
> import org.apache.struts.action.Action;
> import org.apache.struts.action.ActionForward;
> import org.apache.struts.action.ActionMapping;
> import org.apache.struts.action.ActionForm;
> import org.apache.commons.beanutils.BeanUtils;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
> 
> import org.apache.artimus.message.PostBean;
> import org.apache.artimus.message.ThreadBean;
> import org.apache.artimus.message.utility.DateUtil;
> 
> public final class StoreMessage extends Action
> {
>  public ActionForward execute(ActionMapping mapping,
>                               ActionForm form,
>                               HttpServletRequest
> request,
>                               HttpServletResponse
> response)
>       throws Exception
>  {
> 
>     int parentPostID;
>     int threadID;
>     int postID;
>     String postCreationIP;
>     String memberName = request.getRemoteUser();
>     Timestamp now =
> DateUtil.getCurrentGMTTimestamp();
> 
>     parentPostID = Integer.parseInt(
> request.getParameter( "parent" ) );
> 
>     PostForm postForm = ( PostForm )form;
> ....
> ....
> 
>  }
> }
> 
> __________________________________
> Do you Yahoo!?
> Find out what made the Top Yahoo! Searches of 2003
> http://search.yahoo.com/top2003
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org


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


Mime
View raw message