error validation error

2009-05-28 Thread coolsayan

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 - 


Re: error validation error

2009-05-29 Thread coolsayan

what to change please be specific

coolsayan 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" %>
>  "http://www.w3.org/TR/html4/loose.dtd";>
> 
> 
> 
> 
> 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 T

Re: error validation error

2009-05-30 Thread coolsayan

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-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@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

2009-05-30 Thread coolsayan

<%...@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" %>

http://www.w3.org/TR/html4/loose.dtd";>




Login




 Login Form





 register.jsp Register to login 


Enter Your user name:



Enter Your Password:






 forgetpass.jsp Forget Password 




 










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-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@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-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org