This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

cannot compile  RSS feed

 
sojan chandy
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please add struts.jar in the lib of your application.
 
sojan chandy
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!