This week's book giveaway is in the Java in General forum.
We're giving away four copies of Helidon Revealed: A Practical Guide to Oracle’s Microservices Framework and have Michael Redlich on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

How to load a jsp without refreshing.

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic