• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error in compilation.

 
jayaprakash Rengaswamy
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pls. help me to run the struts program steps.

i have enclosed the struts program and its error.



package app;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.struts.action.*;
public class RegisterAction extends Action
{
public ActionForward perform(ActionMapping mapping,ActionForm form,HttpServletRequest req,HttpServletResponse res)
{
app.RegisterForm rf=(app.RegisterForm)form;
String username=rf.getUsername();
String password1=rf.getPassword1();
String password2=rf.getPassword2();
if(password1.equals(password2))
{
try
{
return mapping.findForward("success");
}catch(Exception e)
{
return mapping.findForward("failure");
}
}
return mapping.findForward("failure");
}
}



error
=====

RegisterAction.java:5: package org.apache.struts.action does not exist
import org.apache.struts.action.*;
^
RegisterAction.java:6: cannot resolve symbol
symbol : class Action
location: class app.RegisterAction
public class RegisterAction extends Action
^
RegisterAction.java:8: cannot resolve symbol
symbol : class ActionMapping
location: class app.RegisterAction
public ActionForward perform(ActionMapping mapping,ActionForm form,Http
ervletRequest req,HttpServletResponse res)
^
RegisterAction.java:8: cannot resolve symbol
symbol : class ActionForm
location: class app.RegisterAction
public ActionForward perform(ActionMapping mapping,ActionForm form,Http
ervletRequest req,HttpServletResponse res)
^
RegisterAction.java:8: cannot resolve symbol
symbol : class ActionForward
location: class app.RegisterAction
public ActionForward perform(ActionMapping mapping,ActionForm form,Http
ervletRequest req,HttpServletResponse res)
^
RegisterForm.java:2: package org.apache.struts.action does not exist
import org.apache.struts.action.*;
^
RegisterForm.java:3: cannot resolve symbol
symbol : class ActionForm
location: class app.RegisterForm
public class RegisterForm extends ActionForm

regs
jayaprakash
 
dexter ramirez
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dowload the package that consist <org.apache.struts.action.*>.....

then add to your libraries...
 
jayaprakash Rengaswamy
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, pls. send the download link.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You probably don't need to download them. If you've got Struts installed, then all the libraries should be in the WEB-INF/lib directory of your web application. It's just a matter of adding them to your classpath during compilation.
 
jayaprakash Rengaswamy
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After the classpath setting, the same error is repeating. pls. help me.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is your classpath, and which command are you using for compiling?
 
jayaprakash Rengaswamy
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My classpath is C:\register\WEB-INF\classes\app>RegisterForm.java
and i am using following command for compilation

javac RegisterForm.java.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by jayaprakash Rengaswamy:
My classpath is C:\register\WEB-INF\classes\app>RegisterForm.java


That's not the classpath - that's the directory you're in.

You said you changed the classpath setting - what exactly did you do?

Also, it will be easier if you go one level up the directory hierarchy (into the "classes" directory), and then compile with "javac app/RegisterForm.java".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic