Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

pls help me out with this error

 
sumis mathews
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I'm new to Struts , i just developed a struts program i.e this application is for registration it contains username , password and re-enter password , if password and re-enter password is equal then it forwards to success.jsp else failure.jsp My Application includes :
1) register.jsp
2) success.html
3) failure.html
4)struts-config.xml
5) RegisterForm.java
6) RegisterAction.java


register.jsp:


%@ taglib uri="/WEB-INF/struts-html.tld" prefix ="form" %> <form:form action="/register">
Username : <form:text property="username"/>
enter password:<form assword property="password1"/>
re-enter password:<form assword property="password2"/>
<form:submit value="Register"/> </form:form>


success.html :


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> </HEAD>
<title> success</title>
<BODY>
Registration success


href="register.jsp">try another?


</BODY>
</HTML>

failure.html:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<title> Failure</title>
<BODY>
Registration failed


href="register.jsp">try again?


</BODY>
</HTML>

struts-config.xml:
<struts-config>
<form-beans>
<form-bean name="registerForm"
type="app.RegisterForm"/> </form-beans>


<action-mappings>
<action path="/register"
type="app.RegiesterAction"
name="registerForm"
input="/register.jsp"
<forward name="success" path="/success.html"/>
<forward name="failure" path="/failure.html"/>
</action>
</action-mappings>
</struts-config>


RegisterForm.java:
package app;
import org.apache.struts.action.*;
public class RegisterForm extends ActionForm{
protected String username;
protected String password1;
protected String password2;
public String getUsername () {return username;}
public String getPassword1() {return password1;}
public String getPassword2() {return password2;}
public void SetUsername (String username)
{this.username = username;}
public void SetPassword1(String password)
{this.password1 = password;} public void SetPassword2(String password)
{this.password2 = password;} };


RegisterAction.jsp:
package app;
import org.Apache.struts.action.*;
import javax.servlet.http.*;
import java.io.*;
public class RegisterAction extends Action
{
public ActionForward service (ActionMapping
mapping,ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
RegisterForm rf =(RegisterForm) form;
String username = rf.getUsername();
String password1 = rf.getPassword1();
String password2 = rf.getPassword2();
if(password1.equals(password2))
{
return mapping.findForward("success");
} else
{ return mapping.findForward("failure");
}
}
}


but i encounter an error as follows:


2008-06-04 21:08:13 StandardContext[/manager]
HTMLManager: init: Associated with Deployer 'localhost'
2008-06-04 21:08:13 StandardContext[/manager]HTMLManager:
init: Global resources are available 2008-06-04 21:08:13 StandardContext[/manager]HTMLManager:
list: Listing contexts for virtual host 'localhost'
2008-06-04 21:08:32 StandardWrapperValve[jsp]:
Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: Cannot find ActionMappings
or ActionFormBeans collection at org.apache.struts.taglib.html.FormTag.lookup
(FormTag.java:798)
at org.apache.struts.taglib.html.FormTag.doStartTag
(FormTag.java:506) at
org.apache.jsp.register_jsp._jspx_meth_form_form_0(register_jsp.java:93)
at org.apache.jsp.register_jsp._jspService
(register_jsp.java:68) at org.apache.jasper.runtime.HttpJspBase.service
(HttpJspBase.java:94) at javax.servlet.http.HttpServlet.service
(HttpServlet.java:810) at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:298)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at org.apache.jas
per.servlet.JspServlet.service(JspServlet.java:236)
at javax.servlet.http.HttpServlet.service
(HttpServlet.java:810) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:520) at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:520) at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:520) at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:520) at org.apache.catalina.core.ContainerBase.invoke
(ContainerBase.java:929) at org.apache.coyote.tomcat5.CoyoteAdapter.service
(CoyoteAdapter.java:160) at org.apache.coyote.http11.Http11Processor.process
(Http11Processor.java:793) at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:702)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt
(PoolTcpEndpoint.java:571) at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
at java.lang.Thread.run(Thread.java:595)
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer to your question is found as question 13 in this forum's FAQ.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!