aspose file tools*
The moose likes Struts and the fly likes Struts : Error during compilation of Action Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts : Error during compilation of Action Class" Watch "Struts : Error during compilation of Action Class" New topic
Author

Struts : Error during compilation of Action Class

Vid Srini
Ranch Hand

Joined: Aug 17, 2006
Posts: 35
Hi All,

When the below ActionClass is compiled, the error that occurs is
cannot resolve symbol

public final class LookupAction extends Action {
protected Double getQuote(String symbol) {......... }

public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws IOException,ServletException{

LookupForm lookupForm = (LookupForm) form; //Error occurs here as Cannot Resolve Symbol

lookupForm.getxxx();
}

LookupForm is the JavaBean class which has getter and setter methods.When i tried to access that class in LookupAction,it couldnt identify the LookupForm.

I also tried to import the class(LookupForm) along with the package name in LookupAction class.Then too it produces the same error.

Pls.help me out to compile this java file.

Thanks a lot in advance,
Vidhya S
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Have you verified that the LookupForm class exists in the appropricate subdirectory within the /WEB-INF/classes directory? Is /WEB-INF/classes in your compile-time classpath?
[ August 18, 2006: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
Vid Srini
Ranch Hand

Joined: Aug 17, 2006
Posts: 35
Originally posted by Merrill Higginson:
Have you verified that the LookupForm class exists in the appropricate subdirectory within the /WEB-INF/classes directory? Is /WEB-INF/classes in your compile-time classpath?

[ August 18, 2006: Message edited by: Merrill Higginson ]


Hi Merrill,

I created a new directory called app inside WEB-INF/classes and placed 2 java files(LookupForm&LookupAction).

During the compilation,I have set the path till the subdirectory as WEB-INF/classes/app.
Then too I get the same error...

Thanks,
Vidhya
Jasna Dosen
Greenhorn

Joined: Aug 27, 2002
Posts: 5
Have you put
import <your_package>.LookupForm;

sentence in your action class?
Vid Srini
Ranch Hand

Joined: Aug 17, 2006
Posts: 35
Hi Jasna,

I also tried in this way by giving

import app.LookupForm in my action class.Even in that statement too it throws an error
cannot resolve symbol
Jasna Dosen
Greenhorn

Joined: Aug 27, 2002
Posts: 5
Sorry, I saw lately that you alredy tried that.
I can tell you what is my organization of classes.

Java classes are stored under the WEB-INF/src (pure Java code)
and destination classes directory(include in build path) is defined in Eclipse environment
as WEB-INF/classes.
Obviosly there is some problem with classpath and visibility.
It is hard to tell more without more information about your development environment.
Vid Srini
Ranch Hand

Joined: Aug 17, 2006
Posts: 35
Jasna,

I didnt use any IDE.I created a working folder sample under Tomcat 5.0>webapps directory

I placed both the Java source code as well the class files in the following folder structure: Tomcat 5.0>webapps>WEB-INF>classes>app

Pls help me out to solve this issue.Iam new to struts and strucked up with this issue.

Thanks,
Vidhya S
Jasna Dosen
Greenhorn

Joined: Aug 27, 2002
Posts: 5
If your LookupForm.java
starts with:

package app;

you should put WEB-INF/classes as a path
not WEB-INF/classes/app

Rgd,
Jasna
Vid Srini
Ranch Hand

Joined: Aug 17, 2006
Posts: 35
Hi Jasna,

My pbm is solved.Thanks a lot for your inputs.

The first mistake was i had set the path till the package

second one was my classpath was overridden everytime

solved both the issues.

Thanks a lot,
Vidhya S
 
Don't get me started about those stupid light bulbs.
 
subject: Struts : Error during compilation of Action Class