• 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

How to call servlet before each jsp request

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Friends,

What I want to do is before request goes to any of my jsp i want to call one servlet.

I am planning to check cache in that intermediate servlet ..
if the requested jsp is already cached then that servlet only print the content from cached file.
otherwise it will make url call to the requested jsp in background and will generate the cache file also.
so that it can be useful for next request.

One way to do this is ,... changing the url like this.

Existing URL: http://myserver.com/application/jspname.jsp&id=userid
New URL: http://myserver.com/application/myservlet?page=jspname&id=userid

but for this I need to change path in my whole application.

Isnt it possible through any configuration changes ?

Please suggest me some other way...

Thanks in advance.
Bhavin Pandya
 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by bhavin pandya:
Hello Friends,

What I want to do is before request goes to any of my jsp i want to call one servlet.

I am planning to check cache in that intermediate servlet ..
if the requested jsp is already cached then that servlet only print the content from cached file.
otherwise it will make url call to the requested jsp in background and will generate the cache file also.
so that it can be useful for next request.

One way to do this is ,... changing the url like this.

Existing URL: http://myserver.com/application/jspname.jsp&id=userid
New URL: http://myserver.com/application/myservlet?page=jspname&id=userid

but for this I need to change path in my whole application.

Isnt it possible through any configuration changes ?

Please suggest me some other way...

Thanks in advance.
Bhavin Pandya




Sounds more like a Filter to me. Why not register a Filter in your web.xml? You can even tailor it to be applied only to certain URLs that way.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic