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

Reply via email to