- This topic has 1 reply, 2 voices, and was last updated 20 years ago by Riyad Kalla.
-
AuthorPosts
-
jeanlucnobourgMemberWhat i am doing worng here ?
i am experimenting withhow 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 reportmessage
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” 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>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” 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>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.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.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.xslpackage 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”>
<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>
Riyad KallaMemberIn 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.
-
AuthorPosts