This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

inconvertible types problem with struts tutorial

 
Tony Evans
Ranch Hand
Posts: 598
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am currently working my way through a struts tutorial, I have a problem with the following code: String username = ((LoginForm)form).getUsername();

I get the following compilation error:
apressstruts/LoginAction.java [49:1] inconvertible types
found : org.apache.struts.action.ActionForm
required: apressstruts.LoginForm
String username = ((LoginForm)form).getUsername();
^
This is a direct snippet from the apache struts tutorial.

public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws IOException, ServletException
{
String user = null;

String target = new String("Success");

//Get parameters from the login Form

String username = ((LoginForm)form).getUsername();

return null;
}

Thanks for any help.

Tony
 
Tony Evans
Ranch Hand
Posts: 598
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorted the problem forgot to make LoginForm extend ActionForm.

Tony
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic