camey camey,
Welcome JavaRanch.
We're pleased to have you here with us , but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the
JavaRanch Naming Policyand adjust your display name to match it.
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.
Well for your question you have to understand how the things work. When you press the submit button on the
JSP the control goes to any javascript methods that are onclick of the button. If there are no javascript methods then the form is submitted and it Struts fills your for beans and finally control goes to the execute method of your action.
Now, if you want to do some client side validation using javascript on click of submit then
you should have the data required for validation already on the document precisely the jsp. You can do this by dumping the data as hidden tags or other means.
But, if you want to go to javascript and fetch data from server and then perform client side validation then it is not feasible and moreover it no longer can be said as client side validation as you are hitting the server.
Considering that you have all the data required already on the form you can do client side validation.
E.g. the following script verifies that there is atleast one element selected before going to fetch data for that object
Hope that helps.