Hi ,

 

I have a JSP Page where I have two dropdowns displaying default values.
Before submitting that page, the user should select something from these
two dropdowns and if he doesn't selects, there should be an error
message displayed on the top saying "This field is required".

This is what I am doing but it doesn't gives me an error message and am
able to proceed to the next page. Any idea as to what could be possibly
wrong/missing ?

 

In my validator.xml , I have 

 

                        <form name="ClientReportingForm"> 

                                    <!-- Struts validation -->

                                    <field property="reportType"
depends="required">

                                                <arg0
key="prompt.reportType"/>

                                    </field>

                                    

                                    <field property="productLine"
depends="required">

                                    <arg0 key="prompt.productLine"/>

                                    </field>

                                                

                        </form>

 

In my ApplicationResources.properties I have 

 

            <prompt.reportType     value= "Report Type"/>

            <prompt.productLine    value= "Product Line"/>

 

And in my JSP Page I have 

 

            <logic:messagesPresent message="error" > 

        <bean:message key="errors.header" /> 

        <ul> 

                <font color="red"><b> <html:messages id="error"> 

                        <li><bean:write name="error" filter="false"
/></li> 

                </html:messages> </b> </font> 

        </ul> 

        <bean:message key="errors.footer" /> 

</logic:messagesPresent> 

 

 

Thanks,

Priya

 

Reply via email to