• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Redirecting from JSP to Servlet

 
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi I'm new to JSP.

Can anyone please let me know how to redirect / forward JSP page to servlet without any response/input to the user.

I Mean that when user access input.jsp it should be redirected to a Servlet.

Thanks in Advance.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jay Shukla wrote:I Mean that when user access input.jsp it should be redirected to a Servlet.


Since the purpose of a JSP is to present a view to the user, under what scenario would this be appropriate? It's a big red flag that you may have some serious design problems with your application.
 
Jay Shukla
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Actaully when user access my application by default it'll call index.jsp. because i don't user to access direct URI of my application so when user access my application then it'll redirected to one servlet where it'll run java code and redirect to one more jsp.

So for this purpose could you please let me know the solution for this?


Thanks.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can redefine what default resource they visit by setting it in the welcome-file-list of the deployment descriptor. It's doesn't have to be index.jsp -- that's just the default.

That said, you could use <jsp:forward> to forward to a new resource, or redirect in any number of ways. The most straight-forward being to use HTML META tags to specify the redirect.
 
reply
    Bookmark Topic Watch Topic
  • New Topic