You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by coolsayan <co...@gmail.com> on 2009/05/28 18:19:44 UTC
error validation error
how to solve??why this not working??
code in login.jsp
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ 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"
%>
JSP Page
Login Form
register.jsp Register to login
Enter Your user name:
Enter Your Password:
forgetpass.jsp Forget Password
code in ActionBean:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.myapp.struts;
import javax.naming.NamingException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.*;
import javax.servlet.*;
//import javax.sql.DataSource;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
//import sun.jdbc.odbc.JdbcOdbcDriver;
/**
*
* @author Administrator
*/
public class LoginForm extends org.apache.struts.action.ActionForm {
//private JdbcOdbcDriver serviceLocator;
private String name;
//private String name;
private String password;
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
private int number;
/**
* @return
*/
public String getName() {
return name;
}
/**
* @param string
*/
public void setName(String string) {
name = string;
}
/**
* @return
*/
public int getNumber() {
return number;
}
/**
* @param i
*/
public void setNumber(int i) {
number = i;
}
/**
*
*/
public LoginForm() {
super();
// TODO Auto-generated constructor stub
}
/**
* This is the action called from the Struts framework.
* @param mapping The ActionMapping used to select this instance.
* @param request The HTTP Request we are processing.
* @return
*/
public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request) {
ActionErrors errors = new ActionErrors();
if (getName() == null || getName().length() < 1) {
errors.add("name", new ActionMessage("error.name.required"));
// TODO: add 'error.name.required' key to your resources
}
return errors;
}
}
code in Action servlet:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.myapp.struts;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.*;
import java.io.*;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForward;
/**
*
* @author Administrator
*/
public class LoginAction extends org.apache.struts.action.Action {
/* forward name="success" path="" */
private final static String SUCCESS = "success";
private final static String FAILURE = "failure";
/**
* This is the action called from the Struts framework.
* @param mapping The ActionMapping used to select this instance.
* @param form The optional ActionForm bean for this request.
* @param request The HTTP Request we are processing.
* @param response The HTTP Response we are processing.
* @throws java.lang.Exception
* @return
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
LoginForm formBean = (LoginForm) form;
String name = formBean.getName();
String password = formBean.getPassword();
// perform validation
if ((name.isEmpty()) || // name parameter does not exist
password == null || // email parameter does not exist
name.equals("") || // name parameter is empty
password.isEmpty()) { // password lacks '@'
return mapping.findForward(FAILURE);
}
HttpSession mySession=request.getSession(true);
mySession.setMaxInactiveInterval(30);
return mapping.findForward(SUCCESS);
}
}
Error
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
message
descriptionThe server encountered an internal error () that prevented it
from fulfilling this request.
exception
javax.servlet.ServletException: PWC1244: Servlet execution threw an
exception
root cause
java.lang.NoSuchMethodError:
org.apache.struts.config.ForwardConfig.getContextRelative()Z
note The full stack traces of the exception and its root causes are
available in the Sun GlassFish Enterprise Server v2.1 logs.
--------------------------------------------------------------------------------
Sun GlassFish Enterprise Server v2.1
--
View this message in context: http://www.nabble.com/%3Chtml%3Aerrors-%3E-error-validation-error-tp23765113p23765113.html
Sent from the Struts - User mailing list archive at Nabble.com.
Re: error validation error
Posted by Paul Benedict <pb...@apache.org>.
Update your taglib uris. Struts is no longer a jakarta project, unless
you're using 1.0 or 1.1
On Thu, May 28, 2009 at 11:19 AM, coolsayan <co...@gmail.com> wrote:
>
> how to solve??why this not working??
>
>
>
> code in login.jsp
>
> <%@page contentType="text/html"%>
> <%@page pageEncoding="UTF-8"%>
>
> <%@ 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"
> %>
>
>
>
>
>
> JSP Page
>
>
> Login Form
>
>
>
>
>
>
>
>
> register.jsp Register to login
>
>
>
> Enter Your user name:
>
>
>
>
> Enter Your Password:
>
>
>
>
>
>
>
> forgetpass.jsp Forget Password
>
>
>
>
>
>
>
>
>
>
>
>
>
> code in ActionBean:
>
> /*
> * To change this template, choose Tools | Templates
> * and open the template in the editor.
> */
>
> package com.myapp.struts;
>
> import javax.naming.NamingException;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.*;
> import javax.servlet.*;
> //import javax.sql.DataSource;
> import org.apache.struts.action.ActionErrors;
> import org.apache.struts.action.ActionMapping;
> import org.apache.struts.action.ActionMessage;
> //import sun.jdbc.odbc.JdbcOdbcDriver;
>
> /**
> *
> * @author Administrator
> */
> public class LoginForm extends org.apache.struts.action.ActionForm {
> //private JdbcOdbcDriver serviceLocator;
>
> private String name;
> //private String name;
> private String password;
>
> public String getPassword() {
> return password;
> }
>
> public void setPassword(String password) {
> this.password = password;
> }
>
> private int number;
>
> /**
> * @return
> */
> public String getName() {
> return name;
> }
>
> /**
> * @param string
> */
> public void setName(String string) {
> name = string;
> }
>
> /**
> * @return
> */
> public int getNumber() {
> return number;
> }
>
> /**
> * @param i
> */
> public void setNumber(int i) {
> number = i;
> }
>
> /**
> *
> */
> public LoginForm() {
> super();
> // TODO Auto-generated constructor stub
> }
>
> /**
> * This is the action called from the Struts framework.
> * @param mapping The ActionMapping used to select this instance.
> * @param request The HTTP Request we are processing.
> * @return
> */
>
> public ActionErrors validate(ActionMapping mapping, HttpServletRequest
> request) {
> ActionErrors errors = new ActionErrors();
> if (getName() == null || getName().length() < 1) {
> errors.add("name", new ActionMessage("error.name.required"));
> // TODO: add 'error.name.required' key to your resources
> }
> return errors;
> }
>
>
>
>
> }
>
> code in Action servlet:
>
> /*
> * To change this template, choose Tools | Templates
> * and open the template in the editor.
> */
> package com.myapp.struts;
>
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
> import javax.servlet.http.*;
> import java.io.*;
> import org.apache.struts.action.Action;
> import org.apache.struts.action.ActionForm;
> import org.apache.struts.action.ActionMapping;
> import org.apache.struts.action.ActionForward;
>
> /**
> *
> * @author Administrator
> */
> public class LoginAction extends org.apache.struts.action.Action {
>
> /* forward name="success" path="" */
> private final static String SUCCESS = "success";
> private final static String FAILURE = "failure";
>
> /**
> * This is the action called from the Struts framework.
> * @param mapping The ActionMapping used to select this instance.
> * @param form The optional ActionForm bean for this request.
> * @param request The HTTP Request we are processing.
> * @param response The HTTP Response we are processing.
> * @throws java.lang.Exception
> * @return
> */
> public ActionForward execute(ActionMapping mapping, ActionForm form,
> HttpServletRequest request, HttpServletResponse response)
> throws Exception {
> LoginForm formBean = (LoginForm) form;
> String name = formBean.getName();
> String password = formBean.getPassword();
>
> // perform validation
> if ((name.isEmpty()) || // name parameter does not exist
> password == null || // email parameter does not exist
> name.equals("") || // name parameter is empty
> password.isEmpty()) { // password lacks '@'
>
> return mapping.findForward(FAILURE);
> }
>
> HttpSession mySession=request.getSession(true);
> mySession.setMaxInactiveInterval(30);
> return mapping.findForward(SUCCESS);
> }
> }
>
>
>
>
> Error
>
> HTTP Status 500 -
>
> --------------------------------------------------------------------------------
>
> type Exception report
>
> message
>
> descriptionThe server encountered an internal error () that prevented it
> from fulfilling this request.
>
> exception
>
> javax.servlet.ServletException: PWC1244: Servlet execution threw an
> exception
> root cause
>
> java.lang.NoSuchMethodError:
> org.apache.struts.config.ForwardConfig.getContextRelative()Z
> note The full stack traces of the exception and its root causes are
> available in the Sun GlassFish Enterprise Server v2.1 logs.
>
>
> --------------------------------------------------------------------------------
>
> Sun GlassFish Enterprise Server v2.1
> --
> View this message in context: http://www.nabble.com/%3Chtml%3Aerrors-%3E-error-validation-error-tp23765113p23765113.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: error validation error
Posted by Dave Newton <ne...@yahoo.com>.
Martin Gainty wrote:
> please view this comprehensive explanation of dojo mapped functions by Ted
> http://struts.apache.org/2.1.6/docs/developing-ajax-widgets.html
Wrong thread.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: error validation error
Posted by Dave Newton <ne...@yahoo.com>.
coolsayan wrote:
> <html:errors property="error.name.required" />
From the docs:
"Name of the property for which error messages should be displayed. If
not specified, all error messages (regardless of property) are displayed."
You don't have a property named "error.name.required"--that sounds like
the name of a message resource to me. You have "password" and "name"
properties.
> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="bean" %>
> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
You're using the same URI for two different taglibs. While this will
work, it's probably not what you want. I don't see any uses of bean
tags, so you can just delete the wrong one, or fix it.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: error validation error
Posted by Martin Gainty <mg...@hotmail.com>.
Paul
we will need to see web.xml
struts.xml
struts-default.xml
need to determine which action class '/login' is maps to
then we'll need to see your java action class as well
thanks,
Martin Gainty
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
> Date: Sat, 30 May 2009 12:10:12 -0700
> From: coolsayan.2009@gmail.com
> To: user@struts.apache.org
> Subject: Re: <html:errors/> error validation error
>
>
> <%@page contentType="text/html"%>
> <%@page pageEncoding="UTF-8"%>
>
> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="bean" %>
> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
> <link rel="stylesheet" type="text/css" href="menu.css">
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
> <title>Login</title>
> </head>
> <body>
> <jsp:include page="head.jsp"/>
> <div id="login">
> <h1>Login Form</h1>
> <html:form action="/login">
> <table border="0" cellpadding="10px" cellspacing="10px"
> width="400px">
>
> <tbody>
> <tr>
> <td> register.jsp Register to login </td>
> </tr>
> <tr>
> <td>Enter Your user name:</td>
> <td><html:text property="name" /></td>
> </tr>
> <tr>
> <td>Enter Your Password:</td>
> <td><html:password property="password" /></td>
> </tr>
> <tr>
>
> <td><html:submit value="Login" /></td>
> <td><html:reset value="" /></td>
> <td> forgetpass.jsp Forget Password </td>
> </tr>
> </tbody>
> </table>
>
> <html:errors property="error.name.required" />
>
>
> </html:form>
>
> </div>
>
> </body>
> </html>
>
>
> no error out put still it is configured...what to do?
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Paul Benedict-2 wrote:
> >
> > http://wiki.apache.org/struts/StrutsUpgradeNotes11to124
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/%3Chtml%3Aerrors-%3E-error-validation-error-tp23765113p23796476.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
_________________________________________________________________
Windows Live™: Keep your life in sync.
http://windowslive.com/explore?ocid=TXT_TAGLM_BR_life_in_synch_052009
Re: error validation error
Posted by coolsayan <co...@gmail.com>.
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="menu.css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Login</title>
</head>
<body>
<jsp:include page="head.jsp"/>
<div id="login">
<h1>Login Form</h1>
<html:form action="/login">
<table border="0" cellpadding="10px" cellspacing="10px"
width="400px">
<tbody>
<tr>
<td> register.jsp Register to login </td>
</tr>
<tr>
<td>Enter Your user name:</td>
<td><html:text property="name" /></td>
</tr>
<tr>
<td>Enter Your Password:</td>
<td><html:password property="password" /></td>
</tr>
<tr>
<td><html:submit value="Login" /></td>
<td><html:reset value="" /></td>
<td> forgetpass.jsp Forget Password </td>
</tr>
</tbody>
</table>
<html:errors property="error.name.required" />
</html:form>
</div>
</body>
</html>
no error out put still it is configured...what to do?
Paul Benedict-2 wrote:
>
> http://wiki.apache.org/struts/StrutsUpgradeNotes11to124
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/%3Chtml%3Aerrors-%3E-error-validation-error-tp23765113p23796476.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: error validation error
Posted by Paul Benedict <pb...@apache.org>.
http://wiki.apache.org/struts/StrutsUpgradeNotes11to124
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: error validation error
Posted by Martin Gainty <mg...@hotmail.com>.
please view this comprehensive explanation of dojo mapped functions by Ted
http://struts.apache.org/2.1.6/docs/developing-ajax-widgets.html
hth
Martin Gainty
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
> Date: Sat, 30 May 2009 01:47:39 -0700
> From: coolsayan.2009@gmail.com
> To: user@struts.apache.org
> Subject: Re: <html:errors/> error validation error
>
>
> please specify the taglib syntax.
>
> newton.dave wrote:
> >
> > coolsayan wrote:
> >> what to change please be specific
> >
> > The taglib URIs.
> >
> > Dave
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/%3Chtml%3Aerrors-%3E-error-validation-error-tp23765113p23791499.html
> Sent from the Struts - User mailing list archive at Nabble.com.
_________________________________________________________________
Insert movie times and more without leaving Hotmail®.
http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009
Re: error validation error
Posted by coolsayan <co...@gmail.com>.
please specify the taglib syntax.
newton.dave wrote:
>
> coolsayan wrote:
>> what to change please be specific
>
> The taglib URIs.
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/%3Chtml%3Aerrors-%3E-error-validation-error-tp23765113p23791499.html
Sent from the Struts - User mailing list archive at Nabble.com.
Re: error validation error
Posted by Dave Newton <ne...@yahoo.com>.
coolsayan wrote:
> what to change please be specific
The taglib URIs.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: error validation error
Posted by coolsayan <co...@gmail.com>.
what to change please be specific
coolsayan wrote:
>
> how to solve??why this <html:errors /> not working??
>
>
>
> code in login.jsp
>
> <%@page contentType="text/html"%>
> <%@page pageEncoding="UTF-8"%>
>
> <%@ 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" %>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
> <link rel="stylesheet" type="text/css" href="stylesheet.css">
> <meta http-equiv="Content-Type" content="text/html;
> charset=UTF-8">
> <title>JSP Page</title>
> </head>
> <body>
> <h1>Login Form</h1>
> <html:errors />
> <html:form action="/login">
> <table border="0">
>
> <tbody>
> <tr>
> <td> register.jsp Register to login </td>
> </tr>
> <tr>
> <td>Enter Your user name:</td>
> <td><html:text property="name" /></td>
> </tr>
> <tr>
> <td>Enter Your Password:</td>
> <td><html:password property="password" /></td>
> </tr>
> <tr>
>
> <td><html:submit value="Login" /></td>
> <td><html:reset value="" /></td>
> <td> forgetpass.jsp Forget Password </td>
> </tr>
> </tbody>
> </table>
>
>
>
>
> </html:form>
>
> </body>
> </html>
>
> code in ActionBean:
>
> /*
> * To change this template, choose Tools | Templates
> * and open the template in the editor.
> */
>
> package com.myapp.struts;
>
> import javax.naming.NamingException;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.*;
> import javax.servlet.*;
> //import javax.sql.DataSource;
> import org.apache.struts.action.ActionErrors;
> import org.apache.struts.action.ActionMapping;
> import org.apache.struts.action.ActionMessage;
> //import sun.jdbc.odbc.JdbcOdbcDriver;
>
> /**
> *
> * @author Administrator
> */
> public class LoginForm extends org.apache.struts.action.ActionForm {
> //private JdbcOdbcDriver serviceLocator;
>
> private String name;
> //private String name;
> private String password;
>
> public String getPassword() {
> return password;
> }
>
> public void setPassword(String password) {
> this.password = password;
> }
>
> private int number;
>
> /**
> * @return
> */
> public String getName() {
> return name;
> }
>
> /**
> * @param string
> */
> public void setName(String string) {
> name = string;
> }
>
> /**
> * @return
> */
> public int getNumber() {
> return number;
> }
>
> /**
> * @param i
> */
> public void setNumber(int i) {
> number = i;
> }
>
> /**
> *
> */
> public LoginForm() {
> super();
> // TODO Auto-generated constructor stub
> }
>
> /**
> * This is the action called from the Struts framework.
> * @param mapping The ActionMapping used to select this instance.
> * @param request The HTTP Request we are processing.
> * @return
> */
>
> public ActionErrors validate(ActionMapping mapping, HttpServletRequest
> request) {
> ActionErrors errors = new ActionErrors();
> if (getName() == null || getName().length() < 1) {
> errors.add("name", new ActionMessage("error.name.required"));
> // TODO: add 'error.name.required' key to your resources
> }
> return errors;
> }
>
>
>
>
> }
>
> code in Action servlet:
>
> /*
> * To change this template, choose Tools | Templates
> * and open the template in the editor.
> */
> package com.myapp.struts;
>
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
> import javax.servlet.http.*;
> import java.io.*;
> import org.apache.struts.action.Action;
> import org.apache.struts.action.ActionForm;
> import org.apache.struts.action.ActionMapping;
> import org.apache.struts.action.ActionForward;
>
> /**
> *
> * @author Administrator
> */
> public class LoginAction extends org.apache.struts.action.Action {
>
> /* forward name="success" path="" */
> private final static String SUCCESS = "success";
> private final static String FAILURE = "failure";
>
> /**
> * This is the action called from the Struts framework.
> * @param mapping The ActionMapping used to select this instance.
> * @param form The optional ActionForm bean for this request.
> * @param request The HTTP Request we are processing.
> * @param response The HTTP Response we are processing.
> * @throws java.lang.Exception
> * @return
> */
> public ActionForward execute(ActionMapping mapping, ActionForm form,
> HttpServletRequest request, HttpServletResponse response)
> throws Exception {
> LoginForm formBean = (LoginForm) form;
> String name = formBean.getName();
> String password = formBean.getPassword();
>
> // perform validation
> if ((name.isEmpty()) || // name parameter does not exist
> password == null || // email parameter does not exist
> name.equals("") || // name parameter is empty
> password.isEmpty()) { // password lacks '@'
>
> return mapping.findForward(FAILURE);
> }
>
> HttpSession mySession=request.getSession(true);
> mySession.setMaxInactiveInterval(30);
> return mapping.findForward(SUCCESS);
> }
> }
>
>
>
>
> Error
>
> HTTP Status 500 -
>
> --------------------------------------------------------------------------------
>
> type Exception report
>
> message
>
> descriptionThe server encountered an internal error () that prevented it
> from fulfilling this request.
>
> exception
>
> javax.servlet.ServletException: PWC1244: Servlet execution threw an
> exception
> root cause
>
> java.lang.NoSuchMethodError:
> org.apache.struts.config.ForwardConfig.getContextRelative()Z
> note The full stack traces of the exception and its root causes are
> available in the Sun GlassFish Enterprise Server v2.1 logs.
>
>
> --------------------------------------------------------------------------------
>
> Sun GlassFish Enterprise Server v2.1
>
--
View this message in context: http://www.nabble.com/%3Chtml%3Aerrors-%3E-error-validation-error-tp23765113p23784799.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org