Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

J2EE struts validation: required field in bullet and pop up error message displayed  RSS feed

Chew Wei Kian
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having a problem here. I want the testfield to be a "required" textfield. When i submit the form with testfield blank, a pop up message validator was displayed. But when i add some text into the testfield and submit the form, a bullet point error was displayed on the html. I do not need the bullet point error message. Does anyone have any idea how to solve this? Any help would be appreciated. Thanks! =)

******** my form ****************
<html:form action="/" method="post" onsubmit="return validateMyForm(this)">
<bean:message key="retrieval.testfield"/>
<html:text property="testfield" name="testfield" size="12" value=""/>
<html:submit property="generate" styleClass="buttonlabel" value="Generate Report" />
<html:javascript formName="MyForm" />

********* my struts config xml *************
<!-- ======================================== Application Resources Definitions -->
<message-resources parameter="ApplicationResources" />
<!-- =================================================== Validator plugin -->
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
/WEB-INF/validation.xml" />

********* validation.xml *************
<form name="MyForm">
<arg0 key="MyForm.testfield"/>

********* *************
retrieval.testfield=this is a TestField:
error.testfield.required=TestField is required
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!