File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes How to reload data on JSP page? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How to reload data on JSP page?" Watch "How to reload data on JSP page?" New topic
Author

How to reload data on JSP page?

Nguyen Nam
Greenhorn

Joined: Dec 05, 2012
Posts: 2
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

Joined: Jan 10, 2002
Posts: 60058
    
  65

Use the value attribute on each form element to set its value.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Nguyen Nam
Greenhorn

Joined: Dec 05, 2012
Posts: 2
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

Joined: Jan 10, 2002
Posts: 60058
    
  65

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to reload data on JSP page?
 
Similar Threads
How to update the screen without reloading jsp/sertvlet ?
updating value in bean 2 from bean 1
Error allocating a servlet instance
Sending checkbox value to two different servlet page
Reloading the page data