0

I'm trying to do a system in what the data that the user input the form are saved in page jsp. However not worked! For example:

The user input with data in the form:

<input type="text" name="title" id="title" />

The data that the user input in the form, will be saved in the page jsp:

<% String title = request.getParameter("title") %>

The data will be saved. However when I update the page, the data are missing. I want to make such a comment system.

gstCode
  • 23
  • 1
  • 1
  • 7
  • jsp was a template language, you need learn some thing like servlet / spring mvc, perhaps some persistent skills like database / ORM, or save the title to file – pinkdawn Jul 13 '12 at 01:14
  • I not like to use frameworks. Is best to use the database for this ? – gstCode Jul 13 '12 at 01:24
  • I'm by far not clear with your question. Are you talking about validation? Ara you talking about when your JSP page is refreshed, the data should be persisted on the page (like in TextFields on your JSP page)? If yes and if you're not using any fremework then you're better using JSP `UseBean`. – Lion Jul 13 '12 at 01:50
  • You should learn about Java, JSPs and Servlets before trying to do any programming. BalusC has a nice answer for this [here](http://stackoverflow.com/q/1958808/1065197). – Luiggi Mendoza Jul 13 '12 at 01:56

1 Answers1

0

If you want to save data in the page, then just put it into the value attribute. Try this JSP.

<html>
<body>
<form>
  <input type="text" name="title" id="title" value="${param.title}"/>
  <input type="submit"/>
</form>
</body>
</html>
rickz
  • 4,324
  • 2
  • 19
  • 30
  • 1
    The OP seems not to be familiar with EL therefore a scriplet would be fine for him like `value="<%=request.getParameter("title")%>"`. – Lion Jul 13 '12 at 03:40