Hi Dave,

Thanks a lot for your help! It really does work! What I missed was the 
validate="true" attribute of the action tag, however, this was not mentioned by 
any of the articles I read.

The other thing is that now, the validation error message DID show up, but it 
is displayed on "destination-page" that should only show up when the validation 
was successful.What I want to do is to show the same for until valid values are 
not entered and when all the necessary fields are filled with valid values, 
forward the user to the "destination-page".

Again, I'm missing some settings in my config files.
You told me to use the validate() method but now it's completely removed 
because all the articles told me to remove it...

Here are some parts of my files:

--------------------------------------------------------------------------
Action mapping of struts-config.xml:
--------------------------------------------------------------------------
<action-mappings>        
        
        <action input="/LP/JSP_L01_1.jsp" name="BEAN_L01" path="/L01FormAction" 
scope="request" type="com.myapp.struts.ACT_L01" validate="true">
            <set-property property="cancellable" value="true"/>
            <forward name="cancel" path="/index.jsp"/>
            <forward name="success" path="/LP/JSP_L01_1.jsp"/>
        </action>
        
        <action forward="/LP/JSP_L01.jsp" path="/L01"/>
        
        <action path="/Welcome" forward="/welcomeStruts.jsp"/>
--------------------------------------------------------------------------
The form that should be validated (the textarea only)
--------------------------------------------------------------------------
<html:form action="L01FormAction">
            <table border="1">                
                <tbody>
                    <tr>
                        <td><bean:message key="MSG_JSP_L01_01"/></td>
                        <td><html:select property="ev">
                                <html:option value="2007"/>
                                <html:option value="2009"/>
                                <html:option value="2008"/>
                                <html:option value="2010"/>
                                <html:option value="2011"/>
                                <html:option value="2012"/>
                            </html:select>
                            
                            <html:select property="honap">
                                <html:option 
value="1">Január</html:option><html:option 
value="2">Február</html:option><html:option 
value="3">Március</html:option><html:option 
value="4">Április</html:option><html:option 
value="5">Május</html:option><html:option 
value="6">Június</html:option><html:option 
value="6">Július</html:option><html:option 
value="7">Augusztus</html:option><html:option 
value="9">Szeptember</html:option><html:option 
value="10">Október</html:option><html:option 
value="11">November</html:option><html:option value="12">December</html:option> 
                               
                            </html:select>
                            
                            <html:select property="nap">
                                <html:option value="01"/><html:option 
value="02"/><html:option value="03"/><html:option value="04"/><html:option 
value="05"/><html:option value="06"/><html:option value="07"/><html:option 
value="08"/><html:option value="09"/><html:option value="10"/><html:option 
value="11"/><html:option value="12"/><html:option value="13"/><html:option 
value="14"/><html:option value="15"/><html:option value="16"/><html:option 
value="17"/><html:option value="18"/><html:option value="19"/><html:option 
value="20"/><html:option value="21"/><html:option value="22"/><html:option 
value="23"/><html:option value="24"/><html:option value="25"/><html:option 
value="26"/><html:option value="27"/><html:option value="28"/><html:option 
value="29"/><html:option value="30"/><html:option value="31"/>
                            </html:select>
                            
                            
                        </td>
                    </tr>
                    <tr>
                        <td><bean:message key="MSG_JSP_L01_02"/></td>
                        <td><html:textarea property="leletSzoveg" rows="6" 
cols="30"></html:textarea></td>
                    </tr>
                    <tr>
                        <td><bean:message key="MSG_JSP_L01_03"/></td>
                        <td><html:checkbox property="fileChk" value="1" 
onclick="javascript:leletChkClick();"/>&nbsp;
                            <html:file property="fileURL" size="30" 
disabled="true"/>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <html:submit value="Submit"/>                       
     
                            <html:reset value="Reset"/>
                            <html:cancel />                            
                        </td>
                    </tr>
                    <tr>
                        <td></td>
                        <td></td>
                    </tr>
                </tbody>
            </table>
            <!-- Begin Validator Javascript Function-->
            <%-- <html:javascript formName="BEAN_L01"/> --%>
            <!-- End of Validator Javascript Function-->
            <html:errors/>
        </html:form>


----- Original Message ----
From: Dave Newton <[EMAIL PROTECTED]>
To: Struts Users Mailing List <user@struts.apache.org>
Sent: Tuesday, March 13, 2007 4:24:09 PM
Subject: Re: Validation Framework


--- Balazs Michnay <[EMAIL PROTECTED]> wrote:
> I'm relatively new to Struts and am trying to get
> the Validation Framework working without success.

You neither set validate='true' on your Action (in the
struts-config action-mapping configuration element)
nor call the form bean's 'validate' method (from, say,
your Action).

FWIW, it's usually sufficient to simply post the
relevent portions of the config and source files
rather than providing a ZIP file of your entire
project.

To answer your next question, you can either create an
action-mapping with validate="false" to forward to the
form's JSP page or you can set validate="false" and
call validate manually from within your Action based
on whether or not it's a GET or POST request (assuming
you submit with a POST; personally I have this
behavior in an Action base class and never use the
automagic validation, but this has been discussed to
death in the past :)

d.




____________________________________________________________________________________
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121

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


 
____________________________________________________________________________________
8:00? 8:25? 8:40? Find a flick in no time 
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news

Reply via email to