• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to load a jsp without refreshing.

 
gurusamy sengodan
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

It is very urgent. i hope you people will help me to come out from this problem.

Consider i am having one jsp. Name is A.jsp.
In A.jsp i have used grid to select some records.
I have written one java script function to call one servlet.( Name is LLReportServlet.java)

In servlet i have to redirect to the same jsp ( i mean A.jsp)
While re directing to that jsp it got refreshed. But It should not happen.
Because i have to retain the grid values ( Selected values) once it come back to that Jsp.

Could you please tell me how to do this?


Thanks
Gurusamy
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please EaseUp.

You can either submit all the values to the servlet, so that the JSP page can be delivered with them when it is reloaded, or use an AJAX mechanism to call the servlet.
[ May 30, 2007: Message edited by: Ulf Dittmer ]
 
Edisandro Bessa
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the below code works fine depending on some requirements :




If your servlet redirects the user to A.jsp page through RequestDispatcher.forward method the approach above works fine.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might also split your jsp in two. Read the values from the form on one part and change the url location of an IFrame to load the other part. The part with the detailed data refreshes, but the part with the grid does not.

AJAX is cooler by far, but a bit tricky and is best done with some third party javascript libraries which are hard to get permission for in my shop.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!