I am doing validation inside validate() method.
public void validate(){
if(continent.equals(\"-1\")){
HttpServletRequest request=ServletActionContext
In Struts 2, Client Side Validation has different meanings, and totally depends on the type of theme you are using.
With XHTML
(default) and CSS XHTML
, you can use the
that is totally client side, Javascript based and doesn't communicate with the server.
With the AJAX
theme instead, you can run the
that will contact the server, running the whole validation Stack, and (to answer your question) running your validate()
methods too.
I personally prefer to use the SIMPLE
theme, completely handling the HTML, the CSS and the JavaScript on my own.
Since the server-side validation is mandatory, the client-side validation is to be considered just a surplus, positive for making the page more user-friendly, and to reduce the network traffic in high users environment (you block unsuccessfull - but legit - requests before they go through the wire :)
Consider using HTML5 types with fallback on jQuery, especially if you are targeting the mobile.