I have some problems validating a form with validator framework under
struts 1.3.
After submitting, it forwards to "success" page even if the fields
were not filled properly.
(No exceptions are thrown).

Here's some of my code:

STRUTS-CONFIG.XML
<form-beans>
        ...
        <form-bean
                name="subjectForm"
                type="tfc.controller.formbeans.SubjectForm" />     
        ...
</form-beans>

<action-mappings>

   <action
       path="/SubjectInfoAction"
        type="tfc.controller.actions.SubjectInfoAction"
        name="subjectForm"
        scope="request"
        validate="true"
        input="/pages/kindex.jsp">
                                                
        <exception
                key="errors.notFound"
                path="Exception"
                type="tfc.controller.exceptions.NotFoundException"/>
        
        <forward name="success" path="/topics.jsp"/>
        <forward name="studentSuccess" path="/studentTopics.jsp"/>
    </action>

</action-mappings>

VALIDATION.XML
<formset>
        <form name="subjectForm">
                <field
                        property="subjectId"
                        depends="required">
                        <arg key="parameters.subjectId"/>
                </field>
                                                
                <field
                        property="studentId"
                        depends="integer">
                        <arg key="parameters.studentId"/>
                </field>
        </form>
</formset>

FORM (kindex.jsp)
<jsp:root
        xmlns:jsp="http://java.sun.com/JSP/Page";
        xmlns:html="http://struts.apache.org/tags-html";
        xmlns:logic="http://struts.apache.org/tags-logic";
        xmlns:bean="http://struts.apache.org/tags-bean";
        version="1.2">
        
        <jsp:directive.page contentType="text/html"/>
        
        <jsp:text>                
                <html:html>
                <body>
                
                        <html:errors />
                        
                        <html:form action="SubjectInfoAction">
                                <html:text  styleId="studentId" 
property="studentId"/>
                                <html:text  styleId="subjectId" 
property="subjectId"/>
                                <html:submit property="submit" value="submit"/>
                        </html:form>
                
                </body>
                </html:html>
        </jsp:text>
        
</jsp:root>

FORMBEAN (SubjectForm.java)
It extends ValidationActionForm and it has the getters and setters for
the attributes and some other methods.
It does not impelement reset() nor validate()

ACTION (SubjectInfoAction.java)
It just returns success forward.

PART OF THE LOG
As you can see, it does load 'validation.xml' and 'validation-rules.xml'.
03:03:15,281-INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/TFC]
-No Configuration for this context.  Initializing.
03:03:15,281-INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/TFC]
-configuring cewolf app..
03:03:15,296-INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/TFC]
-using storage class de.laures.cewolf.storage.TransientSessionStorage
03:03:15,296-INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/TFC]
-using overlibURL etc/overlibCewolf.js
03:03:15,296-INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/TFC]
-debugging is turned off
03:03:15,296-INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/TFC]
-...done.
03:03:16,015-INFO org.apache.struts.action.ActionServlet -Loading
chain catalog from
jar:file:/C:/Tomcat5.5/webapps/TFC/WEB-INF/lib/struts-core-1.3.5.jar!/org/apache/struts/chain/chain-config.xml
03:03:17,968-INFO org.apache.struts.validator.ValidatorPlugIn -Loading
validation rules file from '/WEB-INF/validation.xml'
03:03:18,000-INFO org.apache.struts.validator.ValidatorPlugIn -Loading
validation rules file from
'/org/apache/struts/validator/validator-rules.xml'
03:03:19,140-INFO org.apache.struts.tiles.TilesPlugin -Tiles
definition factory loaded for module ''.
...

RESULT
So, as I said before, the application does not crash, but it redirects
to success page even if some
fields' values are not correct.
For example:
        In this case, although 'subjectId' is required, you can leave it empty.


Thanks,
Ramon

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

Reply via email to