After the apply button is clicked, the data entered by the user disappeared in the text form. How to keep the data appearing on the text form?
The server use jsp and the Spring framework and the client use the Prototype javascript library.

Albert,

It sounds like your form is submitted and the server then re-serves the page identically to the way it was served the first time. Hence the form is devoid of the user's entered values.

If you want the server to re-serve the page with the user's data in place then you need to take measures in your server-side code (JSP/Spring) to re-build the form with the data in it. This is typically done when server-side form-validation fails, in which case you also typically include message(s) on the served page to indicate the errors detected (eg. "A valid email address is required").

The action attribute of your <form> tag determines which server side script (page) is requested when the form is submitted. Thus you can call a different JSP script from the one that originally served the form, or the same script. If no action attribute is specified or action="" then the browser assumes that the current page should be re-requested.

The method attribute of your <form> tag controls the way in which the user's form values are packaged in the HTTP request. The two options are "get" and "post" .

For example:

<form action="myscript.jsp" method="get">
<input name="email" />
<br />
<input type="submit" value="Submit">
</form>

Server-side scripts (typically) need to know which method was used so they know where in the HTTP request to look for the submitted form values.

Whereas I have done some JSP, I don't know the Spring framework. It is possible that some or all of the server-side coding (for (a) form building and (b) acting on the user data) is simplified by Spring, compared to raw JSP.

Airshow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.