There are scenarios where you want to silently post a form to server or submit a form without a page refresh. Typical example is a Facebook page where you comment on a post. When you comment, the page is not refreshed but the comment is saved somewhere on the server which means that a save request is sent without entire page submit.
This involves the use of ajax. As soon as we decide to use ajax, a question arises as to how we would send form data from jsp to server without page submit and there would be a big hassle involved in form data transmission. Well!!! After reading this post, you won’t feel the same. (more…)
Any event handling mechanism involves the following components :
- An Event itself.
- A listener which performs action when the event occurs.
- An activity which is responsible for event generation such as a mouse click, record added, deleted and so on.
- A helper object (optional) involved in event chain.
Suppose we have a jsp page which has a form whose data should be sent to the server. The form has fields which are directly related to the fields of an entity on the server. An entity is a simple java class which has some fields and their getter and setter methods.
Let’s say the entity is a User (which means we have a User class on the server and each field of the jsp form is linked to a field of User class. When we say linked, it simply means that the name attribute of the form element is the same as the name of the corresponding entity field. (more…)
There are scenarios where we want to take some actions before a bean is fully constructed and put into service such as
- giving a specific name to the bean other than that given in the configuration,
- setting the application context into a bean property,
- making a log entry immediately after bean initialization etc.
Suppose we want to show a list of registered users of the application in a tabular format on a jsp. The list of users is created on the server and is bound to an attribute (in request, session or application scope) if you are using servlet or bound to an attribute in
ModelAndView if you are using Spring controller as below. (more…)