This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Struts and the fly likes inconvertible types problem with struts tutorial Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "inconvertible types problem with struts tutorial" Watch "inconvertible types problem with struts tutorial" New topic
Author

inconvertible types problem with struts tutorial

Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 521
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

Joined: Jun 29, 2002
Posts: 521
Sorted the problem forgot to make LoginForm extend ActionForm.

Tony
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: inconvertible types problem with struts tutorial
 
Similar Threads
How does Struts create ActionForm objects?
<logic:iterate> problem
java.lang.ClassCastException: org.apache.struts.action.ActionMessage cannot be cast to org.apache.st
problem in Struts Validation
nothing is happening in action class when i submit a page(struts )