wood burning stoves 2.0*
The moose likes Struts and the fly likes cannot compile Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "cannot compile " Watch "cannot compile " New topic
Author

cannot compile

sojan chandy
Greenhorn

Joined: Mar 18, 2007
Posts: 24
i have imported the struts
by

package net;
import javax.servlet.http.*;

but its showing

CustomerForm.java:4: package org.apache.struts.action does not exist
import org.apache.struts.action.ActionError;
^
CustomerForm.java:5: package org.apache.struts.action does not exist
import org.apache.struts.action.ActionErrors;
^
CustomerForm.java:6: package org.apache.struts.action does not exist
import org.apache.struts.action.ActionForm;
^
CustomerForm.java:7: package org.apache.struts.action does not exist
import org.apache.struts.action.ActionMapping;
^
CustomerForm.java:8: package org.apache.struts.action does not exist
import org.apache.struts.action.ActionMessage;
^
CustomerForm.java:10: cannot find symbol
symbol: class ActionForm
public class CustomerForm extends ActionForm{
^
6 errors
RoshaniG Gopal
Ranch Hand

Joined: May 15, 2006
Posts: 180
please add struts.jar in the lib of your application.


Regards,<br />Roshani
sojan chandy
Greenhorn

Joined: Mar 18, 2007
Posts: 24
he i alrdy resolved but it was not because of the lack of struts.jar
i have given the wrong enviornment variable...

but the new problem is ....

can anybody help me

i am getting error while compiling my class CustomerAction ....
i alrdy have compiled my acrionform class i.e... CustomerForm

my classes are in WEB-INF/src/net

the error is

CustomerAction.java:5: cannot find symbol
symbol : class CustomerForm
location: package net
import net.CustomerForm;
^
CustomerAction.java:26: cannot find symbol
symbol : class CustomerForm
location: class net.CustomerAction
CustomerForm custForm = (CustomerForm) form;
^
CustomerAction.java:26: cannot find symbol
symbol : class CustomerForm
location: class net.CustomerAction
CustomerForm custForm = (CustomerForm) form;


code

package net;
import net.CustomerForm;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;

public class CustomerAction extends Action
{
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
if (isCancelled(request)){
System.out.println("The cancel operation Performed");
return mapping.findForward("mainpage.jsp");
}

CustomerForm custForm = (CustomerForm) form;
String firstname=custForm.getFirstname();
String lastname=custForm.getLastname();
System.out.println("Customer Firstname is " + firstname);
System.out.println("Customer Lastname is " + lastname);
ActionForward forward=mapping.findForward("success");
return forward;
}
}



i have alrdy compiled the CustomerForm.jave and placed the clas file in side the same folder
RoshaniG Gopal
Ranch Hand

Joined: May 15, 2006
Posts: 180
have you put the classes in the WEB-INF/classes??
If you are using ant, then the script will do it else you need to explicitly create the same directory structure and put your classes there.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: cannot compile