struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <newton.d...@yahoo.com>
Subject Re: I Have Problem in Developing small application Using Struts
Date Mon, 07 Sep 2009 13:52:44 GMT
I'd start by removing the "." from the form's action attribute and see 
if that fixes it.

Dave

narsimharao_mothkuri wrote:
> Hello to all. I have a problem in struts application. Give me solution to me.
> see my source code
> ===login.jsp======
> <%@taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> 
> <%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 
> <%@page contentType="text/html" pageEncoding="UTF-8"%>
> <html> 
>  <head> 
>   <title>Login Page</title> 
>  </head> 
>  <body> 
>     <html:form action="/Login" focus="username"> 
>        <table align=center>
>           <tr>
>               <td>User Name :</td><td><input type=text      name="username"
> /> </td>
>           </tr>
>           <tr>
>               <td>Password  :</td><td><input type=password  name="password"
> /> </td>
>           </tr>
>           <tr>
>               <td><input type=submit value="Login" /></td> <td><input
> type=reset value = "Reset" /></td>
>           </tr>
>     </html:form> 
>  </body> 
> </html>
> 
> *******************************************
> 
> =========LoginForm.java=====================
> package mnr;
> import javax.servlet.http.*;
> import org.apache.struts.action.*;
> public class LoginForm extends ActionForm
> {
>    public String username;
>    public String password;
>    public LoginForm()
>    {
>       super();
>    }
>    public void setUserName(String string)
>    {
>         this.username = string;
>    }
>    public String getUserName()
>    {
>         return this.username;
>    } 
>    public void setPassWord(String string)
>    {
>         this.password = string;
>    }
>    public String getPassWord()
>    {
>         return this.password;
>    } 
>    public ActionErrors validate(ActionMapping mapping,HttpServletRequest
> request)
>    {
>         ActionErrors errors = new ActionErrors();
>         if(username == null)
>         {
>              errors.add("username",new
> ActionMessage("errors.UserName.required"));
>         }
>         if(password == null)
>         {
>              errors.add("password",new
> ActionMessage("errors.PassWord.required"));
>         }
>         return errors;
>    }
> 
> }
> *************************************
> 
> =================LoginAction.java=================
> package mnr;
> import javax.servlet.http.*;
> import org.apache.struts.action.*;
> public class LoginAction extends Action
> {
>    private static String SUCCESS = "success";
>    private static String FAILURE = "failure";
>    public ActionForward execute(ActionMapping mapping,ActionForm
> form,HttpServletRequest request,HttpServletResponse reponse)
>                                 throws Exception
>    {
>        LoginForm lf = (LoginForm)form;
>        String username = lf.getUserName();
>        String password = lf.getPassWord();
>        if(username.equalsIgnoreCase(password))
>            return mapping.findForward(SUCCESS);
>        else
>            return mapping.findForward(FAILURE);
>    }
> }
> *******************************************************
> ===========struts-config.xml============================
>     <form-beans>
>         <form-bean name="LoginForm" type="mnr.LoginForm"/>
>     </form-beans>
>     <action-mappings>
>         <action input="/login.jsp" 
>                 name="LoginForm" 
>                 path="/Login" 
>                 scope="request" 
>                 type="mnr.LoginAction">
>            <forward name="success" path="/success.jsp" />
>            <forward name="failure" path="/failure.jsp" />
>         </action>
>     </action-mappings>
> ***************************************
> 
> 
> 
> when I run this application this pronbles was i fased
> Exception report
> 
> message 
> 
> description The server encountered an internal error () that prevented it
> from fulfilling this request.
> 
> exception 
> 
> org.apache.jasper.JasperException: Exception in JSP: /login.jsp:9
> 
> 6:   <title>Login Page</title> 
> 7:  </head> 
> 8:  <body> 
> 9:     <html:form action="./Login" focus="username"> 
> 10:        <table align=center>
> 11:           <tr>
> 12:               <td>User Name :</td><td><input type=text     
> name="username" /> </td>
> 
> 
> Stacktrace:
> 
> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
> 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
> 	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
> 	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
> 
> 
> root cause 
> 
> javax.servlet.ServletException: Cannot find ActionMappings or
> ActionFormBeans collection
> 
> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
> 
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
> 	org.apache.jsp.login_jsp._jspService(login_jsp.java:77)
> 	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
> 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> 	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
> 	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
> 
> 
> root cause 
> 
> javax.servlet.jsp.JspException: Cannot find ActionMappings or
> ActionFormBeans collection
> 	org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:747)
> 	org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:443)
> 	org.apache.jsp.login_jsp._jspx_meth_html_005fform_005f0(login_jsp.java:94)
> 	org.apache.jsp.login_jsp._jspService(login_jsp.java:67)
> 	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
> 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> 	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
> 	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> plese tell me solution
> 
> with regards
> Narsimhar Rao


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message