I see you're validating manually in the action. Have you tried doing it automatically with validate=true in the mapping?

I'm not saying you have to do it like that, but it should work that way. You should specify the input attribute in the mapping as well.



On 09/05/2003 03:49 PM Yuan, Saul (TOR-ML) wrote:
Hi Adam,

The problem happens to both client side (javascript) and serverside.
Below are the codes for each file:

Struts-config.xml:

<!-- form beans -->
<form-bean name="messageForm"
type="com.mmi.ratt.emailmanager.message.form.MessageForm" />

<!-- action mapping -->
<action
            attribute="messageForm"
            name="messageForm"
            path="/createMessageAction"
            scope="session"
            validate="false"
type="com.mmi.ratt.emailmanager.message.action.CreateMessageAction">
            <forward name="create_message_step_2"
path="/create_message_step2.jsp" />
            <forward name="input1" path="/create_message_step1.jsp" />
            <forward name="input2" path="/create_message_step2.jsp" />
        </action>


<!-- message resources --> <message-resources parameter="ApplicationResources" />



CreateMessageAction.java:

                // -- validate user input
                ActionErrors errors = messageForm.validate(mapping,
request);

                if(errors != null)              
                        logger.debug("*** number of validation errors: "
+ errors.size());
                else
                        logger.debug("*** number of validation errors:
none");
                
                if (errors != null && !errors.isEmpty()) {
                        logger.debug("*** validation error saved");
        
                        saveErrors(request, errors);
                        if (messageForm.getPage() == 1)
                                return mapping.findForward("input" +
messageForm.getPage());

                        if (messageForm.getPage() == 2)
                                return mapping.findForward("input" +
messageForm.getPage());
                }
                // --


MessageForm.java:


public class MessageForm extends ValidatorForm implements Serializable {

...



BTW, I am able to see the messages when using <bean:message ../>, but
the validator just cannot find them, just says "null is required", the
validator is validating the required fields though.



Thanks,
Saul


-----Original Message-----
From: Adam Hardy [mailto:[EMAIL PROTECTED]
Sent: Friday, September 05, 2003 4:14 AM
To: Struts Users Mailing List
Subject: Re: Validator cannot find message key





Hi Saul,
to try to narrow this down a little, is the problem javascript or
server-side, or both?

One thing it might be is where you specified your
ApplicationResources.properties. It should be something like this in
struts-config.xml :

  <message-resources
    parameter="org.blacksail.ApplicationResources"
    factory="org.apache.struts.util.PropertyMessageResourcesFactory"
    null="true"/>

Perhaps it would help if we could see the relevant form-definition in
your struts-config as well.

Adam



On 09/04/2003 10:03 PM Yuan, Saul (TOR-ML) wrote:

Here is what's in the validation.xml file:

<formset>

       <form name="messageForm">
            <field property="messageName" depends="required"
page="1">
                 <arg0 key="newmessage.label.messageName"
resource="true"/>
            </field>
            <field property="zoneId" depends="required"
page="1">
                 <arg0 key="newmessage.label.zone"
resource="true"/>
            </field>
            <field property="audienceId" depends="required"
page="1">
                 <arg0 key="newmessage.label.audience"
resource="true"/>
            </field>
            ...



and in the application resources file:

newmessage.label.messageName=Message Name
newmessage.label.zone=Distribution Zone
newmessage.label.audience=Target Audience
  ...






-----Original Message-----
From: Koni Roth [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 04, 2003 3:56 PM
To: Struts Users Mailing List
Subject: Re: Validator cannot find message key





Paste the faulty part of your validation.xml file maybe we can see

some



strange things. I had a similar problem and it was only an error in
writing...

Yuan, Saul (TOR-ML) wrote:


Hi,



I am using Struts Validator for validating a multi page form, some

how



the Validator cannot find the messages defined in the application
resources. I got the validation error messages like: null is

required.



I've defined arg0 in the validation.xml file, and the key of arg0

points



to a key in the application resource file. I verified that the

message



can be found through <bean:message>, but why not by the validator?

Any



ideas what the problem could be?





Thanks,

Saul




---------------------------------------------------------------------

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-- struts 1.1 + tomcat 4.1.27 + java 1.4.2 Linux 2.4.20 RH9


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



-- struts 1.1 + tomcat 4.1.27 + java 1.4.2 Linux 2.4.20 RH9


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to