• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts Client Side Validation using JavaScript

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm working on a project that uses Struts as the controller in the middle tier. At present, I'm doing something on client side validation using Struts 1.2. I have a simple app consisting of a single jsp, a single form bean and their respective mappings in the struts-config.xml and the validator-rules.xml and validation.xml files. I give the mappings below. I'm getting an error for which the stack trace is also described below. Plz do advice on how to correct the mapping because the jsp itself is not compiling due to this. Thanks in advance.

MAPPINGS :
struts-config.xml --- Name of the bean is LogonForm
action path="/JSPLogonForm" type="org.apache.struts.actions.ValidatorForm" name="logonForm" scope="request" validate="true" input="LogonValidator.jsp">
<forward name="success" path="sample.jsp" />
</action>

validation.xml
<form name="logonForm">
<field property="username" depends="required">
<arg0 key="LogonForm.username" />
</field>
<field property="password" depends="required">
<arg0 key="LogonForm.password" />
</field>
</form>

Stack Trace
No getter method for property name of bean org.apache.struts.taglib.html.BEAN
at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:968)
at org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.java:176)
at org.apache.jsp.LogonValidator_jsp._jspx_meth_html_text_0(org.apache.jsp.LogonValidator_jsp:299)
at org.apache.jsp.LogonValidator_jsp._jspx_meth_html_form_0(org.apache.jsp.LogonValidator_jsp:215)
at org.apache.jsp.LogonValidator_jsp._jspx_meth_html_html_0(org.apache.jsp.LogonValidator_jsp:131)
at org.apache.jsp.LogonValidator_jsp._jspService(org.apache.jsp.LogonValidator_jsp:82)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
can you post the struts-config.xml form-beans entry and the ActionForm class.
Regards,
Naresh
 
Abhishek Dwaraki
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
These are the form-bean and the Action bean entries... Hope u can figure out wat's happening... Thanks in advance.

<form-beans>
<form-bean name="logonForm" type="com.jpmchase.mm.struts.LogonForm" />
</form-beans>

<action path="/JSPLogonForm" type="com.jpmchase.mm.LogonAction" name="logonForm" input="/LogonValidator.jsp">
<forward name="success" path="/sample.jsp" />
<forward name="failure" path="/index.jsp" />
</action>
 
Abhishek Dwaraki
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry about that Naresh.. I pasted the code of my action path again. I have not used an ActionForm class exactly... LogonForm extends ValidatorForm which is an extension of ActionForm i suppose... Neways this is the code...

package com.jpmchase.mm.struts;

import org.apache.struts.validator.ValidatorForm;

/**
* Bean Class that holds the getter and setter methods for Logon Form
*
* @author Abhishek Dwaraki
*
* @see Logonform.jsp
*
*/
public class LogonForm extends ValidatorForm {

private static final long serialVersionUID = 1234567890987L;

private String username;
private String password;

/**
* Returns the User Name from the data member
*
* @return String Returns a String object with the value of the User Name
*/
public String getUsername() {
return username;
}

/**
* Sets the User Name with the value passed
*
*/
public void setUsername(String
username) {
this.username = username;
}

/**
* Returns the Password from the data member
*
* @return String Returns a String object with the value of the User
* Name
*/
public String getPassword() {
return password;
}

/**
* Sets the value of the Password
*
*/
public void setPassword(String
password) {
this.password = password;
}
}
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic