facebook

Something Wrong Happened in StrutsLoginDemo with 3.8.4

  1. MyEclipse Archived
  2.  > 
  3. Documentation
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #227166 Reply

    iEvil.cn
    Member

    type Exception report

    message

    description The server encountered an internal error () that prevented it from fulfilling this request.

    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.

    I use Eclipse3.0.1 . myEclipse 3.8.4 and Tomcat 5.0.28

    I followed the Help Files to do a Sturts Login Demo but something Wrong!

    Who can tell how to ………….

    THANK YOU VERY MUCH !

    #227176 Reply

    Riyad Kalla
    Member

    I followed the Help Files to do a Sturts Login Demo but something Wrong!

    I’m going to go out on a limb here and say your code is wrong… ever so wrong 😀

    You know, if you posted it for us, we would be able to help you (struts-config.xml, JSP page causing the problem, how you are accessing it, etc.).

    #227184 Reply

    iEvil.cn
    Member

    Sorry I’m a struts beginner.
    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”&gt;
    <struts-config>
    <data-sources />
    <form-beans >
    <form-bean name=”loginForm” type=”com.yourcompany.struts.form.LoginForm” />

    </form-beans>

    <global-exceptions />
    <global-forwards >

    </global-forwards>

    <action-mappings >
    <action
    attribute=”loginForm”
    input=”/login.jsp”
    name=”loginForm”
    path=”/login”
    scope=”request”
    type=”com.yourcompany.struts.action.LoginAction” >
    <forward name=”logined” path=”/Success.jsp” />
    <forward name=”failure” path=”/login.jsp” />
    </action>

    </action-mappings>

    <message-resources parameter=”com.yourcompany.struts.ApplicationResources” />
    </struts-config>
    ===========================================================

    #227185 Reply

    iEvil.cn
    Member

    ==========LoginAction.java===================
    //Created by MyEclipse Struts
    // XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_3.8.4/xslt/JavaClass.xsl

    package 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.LoginForm;

    /**
    * MyEclipse Struts
    * Creation date: 03-26-2005
    *
    * XDoclet definition:
    * @struts:action path=”/login” name=”loginForm” input=”/login.jsp” scope=”request” validate=”true”
    */
    public class LoginAction 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) {
    LoginForm loginForm = (LoginForm) form;
    request.getSession().setAttribute(“userName”,loginForm.getUserName());
    return mapping.findForward(“logined”);
    }

    }
    ========================================================================

    #227186 Reply

    iEvil.cn
    Member

    =========LoginForm.java==========================
    //Created by MyEclipse Struts
    // XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_3.8.4/xslt/JavaClass.xsl

    package com.yourcompany.struts.form;

    import org.apache.struts.action.ActionForm;

    /**
    * MyEclipse Struts
    * Creation date: 03-26-2005
    *
    * XDoclet definition:
    * @struts:form name=”loginForm”
    */
    public class LoginForm extends ActionForm {

    // ——————————————————— Instance Variables

    /** userName property */
    private String userName;

    // ——————————————————— Methods

    /**
    * 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;
    }

    }
    =================================================================

    #227187 Reply

    iEvil.cn
    Member

    ===============Success.jsp==================

    <%@ page language=”java”%>

    <%@ taglib uri=”http://jakarta.apache.org/struts/tags-bean&#8221; prefix=”bean” %>
    <%@ taglib uri=”http://jakarta.apache.org/struts/tags-html&#8221; prefix=”html” %>
    <%@ taglib uri=”http://jakarta.apache.org/struts/tags-logic&#8221; prefix=”logic” %>
    <%@ taglib uri=”http://jakarta.apache.org/struts/tags-tiles&#8221; prefix=”tiles” %>
    <%@ taglib uri=”http://jakarta.apache.org/struts/tags-template&#8221; prefix=”template” %>
    <%@ taglib uri=”http://jakarta.apache.org/struts/tags-nested&#8221; prefix=”nested” %>

    <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
    <html:html locale=”true”>
    <head>
    <html:base />

    <title>Success.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>
    Hi <bean:write name = “userName” scope = “request”/>
    </body>
    </html:html>

    #227188 Reply

    iEvil.cn
    Member

    ================login.jsp=======================

    <%@ page language=”java”%>
    <%@ taglib uri=”http://jakarta.apache.org/struts/tags-bean&#8221; prefix=”bean”%>
    <%@ taglib uri=”http://jakarta.apache.org/struts/tags-html&#8221; prefix=”html”%>

    <html>
    <head>
    <title>JSP for loginForm form</title>
    </head>
    <body>
    <html:form action=”/login”>
    userName : <html:text property=”userName”/><html:errors property=”userName”/><br/>
    <html:submit/><html:cancel/>
    </html:form>
    </body>
    </html>

    #227189 Reply

    iEvil.cn
    Member

    ==========web.xml====================
    <?xml version=”1.0″ encoding=”UTF-8″?>
    <web-app xmlns=”http://java.sun.com/xml/ns/j2ee&#8221; xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221; version=”2.4″ xsi:schemaLocation=”http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd”&gt;
    <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
    <param-name>config</param-name>
    <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
    <param-name>debug</param-name>
    <param-value>3</param-value>
    </init-param>
    <init-param>
    <param-name>detail</param-name>
    <param-value>3</param-value>
    </init-param>
    <load-on-startup>0</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
    </servlet-mapping>
    </web-app>

    ===============================================

    If you can help. I’ll be appricated.

    Thanks

    #227205 Reply

    Riyad Kalla
    Member

    In your JSP, try and change this line:

    <html:form action=”/login”>

    To this:

    <html:form action=”/login.do”>

Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: Something Wrong Happened in StrutsLoginDemo with 3.8.4

You must be logged in to post in the forum log in