Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Struts 1.2.7 Validation blues  RSS feed

Jan van Doorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have wasted many hours on trying to solve this one:

- working with struts 1.2.7, Resin 3.0.14, jdk1.4.

Want to implement Struts validation using validation.xml.

I have a simple Loginform with 2 fields (, registered in struts-config.xml:

<form-bean name="LoginForm" type="nl.upi.workmate.struts.umba.LoginForm" >
<form-property name="userId" type="java.lang.String" />
<form-property name="passWord" type="java.lang.String" />

� and corresponding action:

<forward name="valid" path="/jsp/MainMenu.jsp" />
<forward name="invalid" path="/jsp/LoginView.jsp" />

I defined the plugin in struts-config.xml:

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"

Then why does it not work ??!!
BTW: it does work under Struts 1.1.

When I press submit in the Loginform I get this in the Resin-console:

[22:05:26.256] Server[] starting
[22:05:26.286] http listening to *:80
[22:05:26.316] hmux listening to localhost:6802
[22:05:26.356] Host[] starting
[22:05:26.447] WebApp[http://localhost:80] starting
[22:05:27.027] In-place class redefinition (HotSwap) is not available. In-place class reloading during development requ
ires a compatible JDK and -Xdebug.
[22:05:27.057] WebApp[http://localhost:80/workmate] starting
[22:05:27.758] action: init
** LoginForm.setUserId() <-- ActionForm gets called
** LoginForm.setPassWord()
[22:05:35,129] ERROR ValidatorForm:112 - org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, org.
apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, jav
org.apache.commons.validator.ValidatorException: org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Obje
ct, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErr
ors, javax.servlet.http.HttpServletRequest)

at org.apache.commons.validator.ValidatorAction.loadValidationMethod(
at org.apache.commons.validator.ValidatorAction.executeValidationMethod(
at org.apache.commons.validator.Field.validateForRule(
at org.apache.commons.validator.Field.validate(
at org.apache.commons.validator.Form.validate(
at org.apache.commons.validator.Validator.validate(
at org.apache.struts.validator.ValidatorForm.validate(
at org.apache.struts.action.RequestProcessor.processValidate(
at org.apache.struts.action.RequestProcessor.process(
at org.apache.struts.action.ActionServlet.process(
at org.apache.struts.action.ActionServlet.doPost(
at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(
at com.caucho.server.dispatch.ServletFilterChain.doFilter(
at com.caucho.server.webapp.WebAppFilterChain.doFilter(
at com.caucho.server.dispatch.ServletInvocation.service(
at com.caucho.server.http.HttpRequest.handleRequest(
at com.caucho.util.ThreadPool.runTasks(
LoginAction.execute() <-- Action object should not be called since validation failed
LoginAction.execute() - einde
LoginAction.execute() - invalid
** LoginForm.getUserId()
** LoginForm.getPassWord()

Please help me out on this one !!

Thanks in advance.

[ July 25, 2005: Message edited by: Jan van Doorn ]
[ July 25, 2005: Message edited by: Jan van Doorn ]
alan do
Ranch Hand
Posts: 354
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ActionErrors/ActionError are deprecated since 1.2.x. it looks like you may have validator-rules.xml file (old) that is still defining validator rules using these classes. change these to ActionMessages/ActionMessage instead.
Jan van Doorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem solved !

Reason: there were no corresponding error messages in the Resource file.

<validator name="required"

Looking at an entry in validator-rules.xml:

methodParams="java.lang.Object,org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages,org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest"

... I now understand the exception.

The error was caused because I had no entry for errors.required

[ July 26, 2005: Message edited by: Jan van Doorn ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!