• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts : Error during compilation of Action Class

 
Vid Srini
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Vid Srini
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you put
import <your_package>.LookupForm;

sentence in your action class?
 
Vid Srini
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic