facebook

struts examples from myeclipse Error

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #219508 Reply

    What i am doing worng here ?
    i am experimenting with

    how shall I point my browser to
    my proeejct is called PUS and I am runing tomcat5 from myeclispe
    so it has created a war file called PUS,
    but no matter how I try to call the struts I an error.
    http://localhost:8400/PUS/Login.jsp
    I get the following errors
    type Exception report

    message

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

    exception

    org.apache.jasper.JasperException: Generated method ‘reset(…)’ not implemented.
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
    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

    java.lang.UnsupportedOperationException: Generated method ‘reset(…)’ not implemented.
    com.yourcompany.struts.form.LoginForm.reset(LoginForm.java:52)
    org.apache.struts.taglib.html.FormTag.initFormBean(FormTag.java:560)
    org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:520)
    org.apache.jsp.Login_jsp._jspx_meth_html_form_0(Login_jsp.java:166)
    org.apache.jsp.Login_jsp._jspx_meth_html_html_0(Login_jsp.java:127)
    org.apache.jsp.Login_jsp._jspService(Login_jsp.java:81)
    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.29 logs.

    ——————————————————————————–

    Apache Tomcat/5.0.29*************************************************************

    *************************************************************

    http://www.myeclipseide.com/images/tutorials/quickstarts/struts/

    so I have created
    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” %>
    <%@ 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>Login.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>
    <html:form action=”/login”>
    password : <html:text 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:html>

    UserLogin.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>UserLogin.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>
    This a struts page. <br>
    </body>
    </html:html>

    and
    //Created by MyEclipse Struts
    // XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_3.8.2/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: 11-15-2004
    *
    * XDoclet definition:
    * @struts:action path=”/login” name=”loginForm” input=”/ogin.jsp” scope=”request” validate=”true”
    * @struts:action-forward name=”succes” path=”/Login.jsp”
    * @struts:action-forward name=”failure” path=”/UserLogin.jsp”
    */
    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;
    if(loginForm.getUserName().equals(“myeclipse”) && loginForm.getPassword().equals(“myeclipse”))
    {
    request.setAttribute(“userName”, loginForm.getUserName());
    return mapping.findForward(“success”);
    }

    return mapping.findForward(“failure”);

    }

    }

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

    package com.yourcompany.struts.form;

    import org.apache.struts.action.ActionForm;

    /**
    * MyEclipse Struts
    * Creation date: 11-14-2004
    *
    * XDoclet definition:
    * @struts:form name=”julLoginForm”
    */
    public class JulLoginForm 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;
    }

    }

    Her is my 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=”userForm” type=”com.yourcompany.struts.form.UserForm” />
    <form-bean name=”loginForm” type=”com.yourcompany.struts.form.LoginForm” />

    </form-beans>

    <global-exceptions />
    <global-forwards />
    <action-mappings >
    <action
    attribute=”loginForm”
    input=”/Login.jsp”
    name=”loginForm”
    path=”/login”
    scope=”request”
    type=”com.yourcompany.struts.action.LoginAction”>
    <forward name=”succes” path=”/Login.jsp” />
    <forward name=”failure” path=”/UserLogin.jsp” />
    </action>
    </action-mappings>

    <controller bufferSize=”4096″ debug=”0″ />
    <message-resources parameter=”com.yourcompany.struts.ApplicationResources” />
    </struts-config>

    #219539 Reply

    Riyad Kalla
    Member

    In your struts-config.xml you are referencing a class named “LoginForm” however you pasted the Form code for a class called “JulLoginForm”, so I think you need to go edit your LoginForm class and clean out the reset method… this exception is expected as its the default impl for your reset/validate methods throw these exceptions.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: struts examples from myeclipse Error

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