File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to reload data on JSP page?

 
Nguyen Nam
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSP page. I have a form. When I click on submit to update data that I want to change. Record in database change but data don't show on JSP page. Afterthat, I run Tomcat, data on JSP page change. I use: JSP, Servlet, Hibernate, tomcat 6.

Example:
JSP page: textfield: value = A (load from database)
Database: value = A
---> I want to update:
JSP page: textfield: value = B
--> I click on UPDATE submit (move to Servlet to controll):
JSP page: textfield: value = A
Database: value = B
--> Run Tomcat
JSP page: textfield: value = B


Can any body tell me to reload a jsp page without error? I come from Vietnam so my writing skill no good :D
Thanks advance.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the value attribute on each form element to set its value.
 
Nguyen Nam
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Use the value attribute on each form element to set its value.


Can you explain clearly?
My JSP page:

<%
List<Username> list = (List<Username>)(request.getAttribute("ListUsername"));
for(int i = 0; i < list.size(); i++)
{
Username nd = list.get(i);
...
...
...
%>
<form id="form" name="form" method="post" action="UpdateUserController">
<input id="username" type="text" value="<%=nd.getUsername() %>" name="username">
<input class="btn" type="submit" value="Update" style="width: 100px">
</form>
<%
...
...
}
%>
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, aside from the fact that your JSP is using obsolete technology (read this JspFaq entry), the phrase
will preload the value with whatever nd.getUsername() returns, so it looks like you are on the right track.

But you really should update your JSP knowledge. You are using technology in your JSP that has been obsolete for over 10 years.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic