File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes ???en_US.errors.required??? instead of fileds names Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "???en_US.errors.required??? instead of fileds names" Watch "???en_US.errors.required??? instead of fileds names" New topic

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

Nadine Hossam

Joined: Jun 19, 2005
Posts: 13
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 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="" />
<html assword styleClass="inputText" property="pin" redisplay="false"/>

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


<html:javascript formName="VFCLoginForm"/>

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

and in my struts-config.xml

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

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

<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" />

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


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


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

Joined: Jun 19, 2005
Posts: 13
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=""/>
<msg name="required" key=""/>

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?
I agree. Here's the link:
subject: ???en_US.errors.required??? instead of fileds names
It's not a secret anymore!