JSP refresh page through servlet -


I want to use the servlet code to refresh the jsp page.

"my_list.jsp" "My_add.jsp" is a page that user can input some to add items to the list in "my_list.jsp"

Is design.

Enter image details here

Add item "in user" Click on "My_list.jsp" and a pop-up will be "my_add.jsp" to complete the user input and add items to the list after clicking on "Add button", add this item to "AddServlet. Java "will trigger.

  AddServlet.java Protects zero doPost (HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {AddItem (); Resp.sendRedirect ("/ my_add.jsp"); Resp.setHeader ("Refresh", "0"); }  

Because the user can add more items, I do not want to close the page "my_add.jsp" after adding an item. Therefore I write the following in "AddServlet.java"

  resp.sendRedirect ("/ my_add.jsp"); Resp.setHeader ("Refresh", "0");  

But now, after clicking the "Add button" on the user "my_add.jsp" page, "my_list.jsp" will not be updated. "My_list.jsp" will only be updated when I click on "close button" in "my_add.jsp" or "refresh" in "my_list.jsp"

I need to know if there is any way to "add my button" in "My_add.jsp" after refreshing the "my_list.jsp" page.

Thanks in advance.

Eric

Two pages like "" my_list.jsp "and Instead of being "my_add.jsp" . Use a jquery dialog with my_list.jsp so it will trigger the dialog as you would in my_add.jsp Has been shown.

Now just call an AJAX call from my_list.jsp after jquery confirmation so that you can my_list.jsp

Hope it helps !!


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -