- This topic has 3 replies, 3 voices, and was last updated 20 years, 1 month ago by
Riyad Kalla.
-
AuthorPosts
-
iEvil.cnMemberI did a project for StrutsLoginDemo.
I followed this tutorials
http://myeclipseide.com/enterpriseworkbench/help/index.jsp?topic=/com.genuitec.myeclipse.doc/html/quickstarts/struts/index.htmlBut same wrong message has disappared.
exception
javax.servlet.ServletException: Cannot find ActionMappings or ActionFormBeans collection
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.userLogin_jsp._jspService(userLogin_jsp.java:88)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)root cause
javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:798)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:506)
org.apache.jsp.userLogin_jsp._jspx_meth_html_form_0(userLogin_jsp.java:104)
org.apache.jsp.userLogin_jsp._jspService(userLogin_jsp.java:78)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
here is my files
=============struts-config.xml=========
<?xml version=”1.0″ encoding=”UTF-8″?>
<!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>
<data-sources />
<form-beans >
<form-bean name=”userLoginForm” type=”com.yourcompany.struts.form.UserLoginForm” /></form-beans>
<global-exceptions />
<global-forwards />
<action-mappings >
<action
attribute=”userLoginForm”
input=”/userLogin.jsp”
name=”userLoginForm”
path=”/userLogin”
scope=”request”
type=”com.yourcompany.struts.action.UserLoginAction”>
<forward name=”success” path=”/userLoginSuccess.jsp” />
<forward name=”failure” path=”/userLogin.jsp” />
</action></action-mappings>
<message-resources parameter=”com.yourcompany.struts.ApplicationResources” />
</struts-config>==============================================
==========UserLoginForm.java========================
//Created by MyEclipse Struts
// XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_3.8.4/xslt/JavaClass.xslpackage com.yourcompany.struts.form;
import org.apache.struts.action.ActionForm;
/**
* MyEclipse Struts
* Creation date: 03-27-2005
*
* XDoclet definition:
* @struts:form name=”userLoginForm”
*/
public class UserLoginForm extends ActionForm {// ——————————————————— Instance Variables
/** password property */
private String password;/** userName property */
private String userName;// ——————————————————— Methods
/**
* Returns the password.
* @return String
*/
public String getPassword() {
return password;
}/**
* Set the password.
* @param password The password to set
*/
public void setPassword(String password) {
this.password = password;
}/**
* Returns the userName.
* @return String
*/
public String getUserName() {
return userName;
}/**
* Set the userName.
* @param userName The userName to set
*/
public void setUserName(String userName) {
this.userName = userName;
}}
============================================
=============UserLoginAction.java==================
//Created by MyEclipse Struts
// XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_3.8.4/xslt/JavaClass.xslpackage com.yourcompany.struts.action;
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;import com.yourcompany.struts.form.UserLoginForm;
/**
* MyEclipse Struts
* Creation date: 03-27-2005
*
* XDoclet definition:
* @struts:action path=”/userLogin” name=”userLoginForm” input=”/userLogin.jsp” scope=”request” validate=”true”
* @struts:action-forward name=”success” path=”/userLoginSuccess.jsp”
* @struts:action-forward name=”failure” path=”/userLogin.jsp”
*/
public class UserLoginAction extends Action {// ——————————————————— Instance Variables
// ——————————————————— Methods
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
UserLoginForm userLoginForm = (UserLoginForm) form;
if(userLoginForm.getUserName().equals(“myeclipse”) && userLoginForm.getPassword().equals(“myeclipse”))
{
request.setAttribute(“userName”, userLoginForm.getUserName());
return mapping.findForward(“success”);
}return mapping.findForward(“failure”);
}
}
============================================
March 26, 2005 at 10:57 pm #227191
iEvil.cnMemberand here are 2 jsp files
==============userLoginSuccess.jsp==================
<%@ page language=”java”%>
<%@ taglib uri=”http://jakarta.apache.org/struts/tags-bean” prefix=”bean” %>
<%@ taglib uri=”http://jakarta.apache.org/struts/tags-html” prefix=”html” %>
<%@ taglib uri=”http://jakarta.apache.org/struts/tags-logic” prefix=”logic” %>
<%@ taglib uri=”http://jakarta.apache.org/struts/tags-tiles” prefix=”tiles” %>
<%@ taglib uri=”http://jakarta.apache.org/struts/tags-template” prefix=”template” %>
<%@ taglib uri=”http://jakarta.apache.org/struts/tags-nested” prefix=”nested” %><!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html:html locale=”true”>
<head>
<html:base /><title>userLoginSuccess.jsp</title>
<meta http-equiv=”pragma” content=”no-cache”>
<meta http-equiv=”cache-control” content=”no-cache”>
<meta http-equiv=”expires” content=”0″>
<meta http-equiv=”keywords” content=”keyword1,keyword2,keyword3″>
<meta http-equiv=”description” content=”This is my page”>
</head><body>
Hello <bean:write name=”userName” scope=”request” />, you successfully logged in!
</body>
</html:html>
======================================================================================================userLogin.jsp====================================================================
<%@ page language=”java”%>
<%@ taglib uri=”http://jakarta.apache.org/struts/tags-bean” prefix=”bean”%>
<%@ taglib uri=”http://jakarta.apache.org/struts/tags-html” prefix=”html”%><html>
<head>
<title>JSP for userLoginForm form</title>
</head>
<body>
<html:form action=”/userLogin”>
password : <html:password property=”password”/><html:errors property=”password”/><br/>
userName : <html:text property=”userName”/><html:errors property=”userName”/><br/>
<html:submit/><html:cancel/>
</html:form>
</body>
</html>
=====================================================================================It’s very improtant for me . Please help!
May 28, 2005 at 11:39 am #230315
Randall SvancaraMemberI am having this very same problem….however I cannot seem to find an answer. I keep recieving
Cannot find ActionMappings or ActionFormBeans collection. When my laptop is disconnected from the internet, I recieve this error, when I am connected, I no longer recieve this error.Randall
May 29, 2005 at 10:33 am #230337
Riyad KallaMemberGuys your action is wrong for your FORM in your JSP pages, it needs to be something like “userLogin.do”, you are forgetting the .do ending so the StrutsServlet isn’t able to map the request to Struts.
-
AuthorPosts