This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Micro Frontends in Action and have Michael Geers on-line!
See this thread for details.
Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

cannot compile

 
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
 
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 Therakom
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.
 
Whatever you say buddy! And I believe this tiny ad too:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic