• 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

???en_US.errors.required??? instead of fileds names

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm using the validator framework with struts, in order to validate the user data. And I wanted to get the error messages from the MessageResources_en.properties file. But instead it writes ???en_US.errors.required??? instead of fileds names

I don't think that there's a problem with my message resource file as the rest of the fields titles in the page are displayed properly from this property file

Here s my Form JSP
<html:form method="post" action="vfcLogin" onsubmit="return validateVFCLoginForm(this);">

<fmt:message key="my.pin" />
<html assword styleClass="inputText" property="pin" redisplay="false"/>

<html:submit styleClass="okBtn" ><fmt:message key="button.submit"/></html:submit>

<html:errors/>

<html:javascript formName="VFCLoginForm"/>


and my validation.xml
<form name="VFCLoginForm">
<field property="pin"
depends="required">
<arg key="error.pin.required"/>
</field>
</form>

and in my struts-config.xml

<struts-config>
<form-beans>
<form-bean name="VFCLoginForm"
type="com.bean.VFCLoginForm" />
</form-beans>

<action-mappings>
<action path="/vfcLogin"
type="com.action.VFCLoginAction" name="VFCLoginForm"
scope="request" validate="true" input="/JSP/vfc.jsp">
<forward name="success" path="/JSP/vfc.jsp" />
</action>
</action-mappings>

<message-resources parameter="MessageResources" null="false" />

<plug-in className="org.apache.struts.tiles.TilesPlugin">
<set-property property="definitions-config"
value="/WEB-INF/tiles-defs.xml" />
<set-property property="moduleAware" value="true" />
<set-property property="definitions-parser-validate"
value="true" />
</plug-in>

<!-- Validator plugin -->
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml" />
</plug-in>

</struts-config>


and defined the message resource property file in my web.xml

<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>MessageResources</param-value>
</context-param>


So i really don't know where this error is coming from.
Any idea?

Another thing, how do I define whether do I want a popup msg to appear or just write the errors in the page?
currently this code is generating a popup msg with this error msg ???en_US.errors.required???
 
Nadine Hossam
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey all,
I found out what the problem is. It was in the validation.xml.
All you have to do is to replace
<arg key="error.pin.required"/>
with
<msg name="required" key="error.pin.required"/>

Didn't know the reason, perhaps it's a bug or something.

Any suggestions about how to specify whether I need it in popup msg or to be printed in the page?
 
The moth suit and wings road is much more exciting than taxes. Or this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic