In my webpage I want to call action method without using a submit button. Scenario is like below.
1. I am having a form with action url set to enroll a student. Within a form i have student name,age etc. and also a search panel where user can enter his new userid. There is a submit button also to submit the form.
2. user key in userid in a text field and press "Check availability" button. This button is not a submit button. So I am using a button click event and in the function I am calling availability method in StudentAction class. I am using JQuery for this (Please let me know if there is a good approach). I do not prefer to put form within a form.
3. Example provided in the given link is like below
but I need to use regular expressions to validate user input. How can i achieve this in the above method of validation? Please let me know.
@2. Writing the JQuery code to call an action is fine. But you can have any number of submit (JQuery or Struts2) buttons that calls different actions. So Writing the JQuery code to call an action is extra work.
@3. Example given in the link is using annotated version. regex validation is supported in annotated, using an xmlversions too . Also you can validate by overriding the validate ().