Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Display a webpage after running the servlet

 
Ann Toh
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
now i am writing a servlet to write into a jsp file. which mean i execute the servlet program, the program will write the data(html and others) and save in a jsp file. how do i display the jsp file after i execute the servlet without giving a link to link to that jsp page??
thanx in advance...
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ann Toh:
the program will write the data(html and others) and save in a jsp file. how do i display the jsp file after i execute the servlet without giving a link to link to that jsp page??
thanx in advance...

Its not good idea to the dynamic content into a jsp file and display it. You can directly display the output the same servlet that you used to capture/process data!..
If you still want to use jsp option, then you can use the redirect() function to direct to the jsp from the servlet.
 
Ann Toh
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Balaji Loganathan,
thank for ur help. actually, i have written the program to display the jsp page but it does not display, so i have to write and save it as a jsp file then i need to point to the jsp file and display it.
can u tell me how to write a redirect() function in the servlet to point to that jsp file??
thanx in advance...
 
Praful Thakare
Ranch Hand
Posts: 642
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
response.sendRedirect("urjspname.jsp");
Praful
 
Ann Toh
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Praful Thakare,
thanx for ur help. i can get to link to my jsp page.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic