• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

redirecting to a new page from servlet  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am sending data to the servlet from login.html using JQuery in json format to the servlet and after matching the record i want to open a new page home.html and i also want to send the data to home.html page

 
Master Rancher
Posts: 1162
18
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what technologies you use or how it works when returning an jsonObect, but you need to change the retun value of your method to a string or ModelAndView
for string it would be something like
 
Sheriff
Posts: 21649
101
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That only works in Spring controllers. In regular servlets you need to use response.sendRedirect("home.html"), assuming the page is relative to the current URL.
 
Daniel Demesmaecker
Master Rancher
Posts: 1162
18
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Rob Spoor wrote:That only works in Spring controllers. In regular servlets you need to use response.sendRedirect("home.html"), assuming the page is relative to the current URL.


Could be, I always use springBoot when creating a webapp, so sorry for the misinformation
 
Curse your sudden but inevitable betrayal! And this tiny ad too!
Become a Java guru with IntelliJ IDEA
https://www.jetbrains.com/idea/
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!