• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

inconvertible types problem with struts tutorial

 
Ranch Hand
Posts: 681
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 681
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorted the problem forgot to make LoginForm extend ActionForm.

Tony
 
reply
    Bookmark Topic Watch Topic
  • New Topic