Hi I am new to struts and trying to run my first struts application, but getting error while try to compile my Formbeam, error message is : ======================================== C:\j2sdk1.4.1_02\bin\com\struts\LookupForm.java:6: package org.apache.struts.action does not exist import org.apache.struts.action.ActionForm; ^ C:\j2sdk1.4.1_02\bin\com\struts\LookupForm.java:7: package org.apache.struts.action does not exist import org.apache.struts.action.ActionMapping; ^ C:\j2sdk1.4.1_02\bin\com\struts\LookupForm.java:10: cannot resolve symbol symbol : class ActionForm location: class com.struts.LookupForm public class LookupForm extends ActionForm{ ^ C:\j2sdk1.4.1_02\bin\com\struts\LookupForm.java:30: cannot resolve symbol symbol : class ActionMapping location: class com.struts.LookupForm public void reset(ActionMapping mapping, HttpServletRequest request) { ^ 4 errors ============================================ code is : <CODE> package com.struts; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping;
public class LookupForm extends ActionForm{ private String symbol=null;
public String getSymbol(){ return (symbol); } public void setSymbol(String symbol){ this.symbol=symbol;
} public void reset(ActionMapping mapping, HttpServletRequest request) {
this.symbol=null; }
} </CODE>
my struts-config.xml looks like this: <CODE> <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation //DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"> <struts-config> <message-resources parameter="com.struts.ApplicationResources" />
and my we.xml looks like this: <CODE> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/j2ee/dtd/web-app_2_3.dtd"> <web-app> <taglib> <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri> <taglib-location>/WEB-INF/struts-html.tld</taglib-location> </taglib> </web-app> </CODE> and I have put struts.jar, commons-beanutils.jar, commons-collections.jar, commons-dbcp.jar, commons-digester.jar, commons-logging.jar, commons.pool.jar, commons-validator.jar in WEB-INF/lib directory.
Jaffery Rab
Ranch Hand
Joined: Jan 18, 2002
Posts: 36
posted
0
just discard <CODE> tag also I am using tomcat4
Chris Mathews
Ranch Hand
Joined: Jul 18, 2001
Posts: 2712
posted
0
How are you compiling your classes? Regardless, you need to make sure the Struts classes are on your compiler CLASSPATH.
Jaffery Rab
Ranch Hand
Joined: Jan 18, 2002
Posts: 36
posted
0
how can I put struts classes in in my class path. I have copied all struts jar files in my WEB-INF/lib is it not enough?
Chris Mathews
Ranch Hand
Joined: Jul 18, 2001
Posts: 2712
posted
0
Originally posted by Jaffery Rab: how can I put struts classes in in my class path. I have copied all struts jar files in my WEB-INF/lib is it not enough?
These classes are used by the Web Container when the web application is deployed. They are not used by the compiler unless you explicitly put them on the compiler's CLASSPATH.
Jaffery Rab
Ranch Hand
Joined: Jan 18, 2002
Posts: 36
posted
0
I have put my .java classes in src folder in <CATALINA_HOME>/webapps/StrutsProject/WEB-INF/src and trying to compile it from there. I have also put all struts jar in <CATALINA_HOME>/webapps/StrutsProject/WEB-INF/lib what else am I supposed to do to make all struts classes available for compiler classpath. Also I have all struts jar files in lib directory of my jdk.../lib an put .java in jdk../bin and try to compile it from there but got same error.
How and where can I put all struts jar files so I will get rid of this error. Please help me !
Thomas Paul
mister krabs
Ranch Hand
Joined: May 05, 2000
Posts: 13974
posted
0
Put them in your classpath. You can also read the articles that I wrote which suggest placing your sturts.jar file in the ext directory.