• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to use only Server Side Validation

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would want to use only Server Side validation using Struts. How do i go about it.
Do i have to configure the Validation.xml,validation-rules.xml in this case?

Can i get a step wise idea of how to go about it?

Thanks

Tarun
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you do not code your JSP to plug into the client-side validation, no client-side validation will take place. The steps required to plug a JSP into client-side validation are:

* put onsubmit="return validateMyForm(this)" into the <html:form> tag, where MyForm is the ActionForm name used by this page.
* put <html:javascript form="myForm" /> somewhere in the page.

So, if you don't do this in your JSPs, only server side validation will be performed.
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Confusing,,

<action
path="/SomeAction"
type="com.a.SomeAction"
name="SomeForm"
scope="request"
validate="true"
input="/pages/input.jsp">
<forward name="success" path="/pages/success.jsp"/>
</action>

This is the way how we use a client side validation in struts.

If validate="false", struts wont do your client side validation.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The point I'm making is that even if you specify validate="true" in your action mapping, client-side validation will still not take place unless you've modified your JSP to allow for it. If you never want to use client-side validation, you don't have to do anything... just don't put the code in your JSPs.
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

For performing server side validation, you could configure the validation.xml file or u could validate in your action class itself, based on ur own custom defined rules.
For configuring the validation.xml file you can check this link out.

Hope this helps.

Liju
 
Cheenath Ajay
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Liju,

That was a really nice to know that you became an expert in Struts.

Good to know that still Java innovations are going on in Assyt.

Enjoy.

Ajay Francis.
 
reply
    Bookmark Topic Watch Topic
  • New Topic