Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts validation

leo oke
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm try to validate a form using struts Form with Validator, I want to validate the no input & maxlength. I've setup the configs but when I test the form it only shows "Validation Error(s), UserName is required."
even if I've put a username.. why?

part code:

form jsp

<html:javascript formName="loginForm"/>

<html:form action="/login">

<td width="15%">Enter your name:</td>
<td width="85%">
<html:text property="name" size="25" maxlength="50"

public class LoginForm extends org.apache.struts.validator.ValidatorForm{

private String name = null;

private String result ;

public void setName(String name) { = name;

public String getName() {
return name;

public void setResult(String result) {
this.result = result;

public String getResult() {
return result;

<form name="loginForm">

<arg position="0" key="loginForm.username"/>
<arg position="1" key="${var:maxlength}" name="maxlength"


Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic