JavaServer Pages (JSP) and JSTL - Question with Struts ActionServlet

Hi,everybody.

I have written a simple application using Struts.The program is used to validate a user who login to the system.I have added all *.jar library file of Struts 1.2.6 to the Tomcat project,But after I accessed to Login page,enter username and password,and then click "Login" button,It popup the following exception:

Error loading WebappClassLoader

delegate: false

repositories:

/WEB-INF/classes/

-> Parent Classloader:

org.apache.catalina.loader.StandardClassLoader@fe315d

org.apache.struts.action.ActionServlet

java.lang.ClassNotFoundException: org.apache.struts.action.ActionServlet

at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1355)

at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1201)

at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1034)

at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:757)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:130)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)

at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)

at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)

at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)

at java.lang.Thread.run(Unknown Source)

and the web.xml file is list as following:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app

PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"

"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

<!-- Action Servlet Configuration -->

<servlet>

<servlet-name>actionServlet</servlet-name>

<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>

</servlet>

<!-- Action Servlet Mapping -->

<servlet-mapping>

<servlet-name>actionServlet</servlet-name>

<url-pattern>*.do</url-pattern>

</servlet-mapping>

<!-- The Welcome File List -->

<welcome-file-list>

<welcome-file>login.jsp</welcome-file>

</welcome-file-list>

</web-app>

struts-config.xml is listed as following:

<?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>

<form-beans>

<form-bean name="formBean1" type="classmate.UserForm"/>

</form-beans>

<global-forwards>

<forward name="failed" path="/error.jsp"/>

<forward name="successed" path="/right.jsp"/>

</global-forwards>

<action-mappings>

<action path="/login" type="classmate.LoginAction" name="formBean1" scope="request" input="/login.jsp" />

<action path="/regist" forward="/regist.jsp"/>

</action-mappings>

</struts-config>

if anybody can help me to resovle this question? Please Reply .

Besides this,I also have another question I want to ask,it is that how to install Struts plugin to Eclipse,I have tried to unziped the download EasyStruts plugin to the Eclipse plugins directory,but after click Window->Preference ,I have not found the EasyStruts item in the left of the pop-up panel,the Eclipse version is 3.1.2 and have installed lomboz in it.if anybody have practice in such installation? Please response to help me.

Thank you and Regards.

[4461 byte] By [Devemora] at [2007-11-26 23:14:26]
# 1
Please make sure you place all your *.jar files in the /WEB-INF/lib folder of your webapp and not under any other folder such as /WEB-INF/classes.
Devanga at 2007-7-10 14:13:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Hi,

Thank you for response.I have modified the program as what you told me.it can startup now,But it suspended at LoginAction,the running message is printed as following:

LoginAction.execute(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse) line: 18

RequestProcessor.processActionPerform(HttpServletRequest, HttpServletResponse, Action, ActionForm, ActionMapping) line: 419

RequestProcessor.process(HttpServletRequest, HttpServletResponse) line: 224

ActionServlet.process(HttpServletRequest, HttpServletResponse) line: 1192

ActionServlet(HttpServlet).service(HttpServletRequest, HttpServletResponse) line: 709

..........................................................................................................

when I click on the information "RequestProcessor.processActionPerform",it popup a message that show "Source not found ,The jar file Struts.jar has no source attachment",Does it need to attach the source of struts.jar?

I list the LoginAction.java as following:

package classmate;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;

import org.apache.struts.action.ActionForm;

import org.apache.struts.action.ActionForward;

import org.apache.struts.action.ActionMapping;

public final class LoginAction extends Action{

public ActionForward execute(

ActionMapping mapping,

ActionForm form,

HttpServletRequest request,

HttpServletResponse response) throws Exception {

UserForm userform = (UserForm) form;

String name = userform.getName();

String psw = userform.getPsw();

if("jenny".equals(name) && "hi".equals(psw)){

UserLoginLog ul = new UserLoginLog();

ul.save(name,psw);

return mapping.findForward("successed");

}else{

return mapping.findForward("failed");

}

}

}

as I debuged the program,the breakpoint line "UserForm userform = (UserForm) form; "

and the UseForm.java is listed as following:

package classmate;

import org.apache.struts.action.ActionForm;

public class UserForm extends ActionForm{

/**

*

*/

private static final long serialVersionUID = 1L;

private String name = null;

private String psw = null;

public UserForm(){}

public void setName(String name) {

this.name = name;

}

public String getName() {

return name;

}

public void setPsw(String psw) {

this.psw = psw;

}

public String getPsw() {

return psw;

}

}

and I have written the web.xml and struts-config.xml in above message.

how can I run through the breakpoint line so that I can access the ActionForm's Data? if anybody can tell me how to resovle it ,Please reply to help me.Thanks you.

Message was edited by:

Devemor

Devemora at 2007-7-10 14:13:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...