• 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

Problem Servlet Filter

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi friends,
I am using a simple filter just to display a image in a .html or jsp.
its running fine with all jsp and html in both cases,either invoked before or after the page.

But i encounter a problem when it invoked before a html page which contain framset. except the image from the filter nothing get displayed. but if i invoked after the page, both page contents and image from the filter get displayed.

please help me out.
thanks
Abhishek
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why and how are you using a filter to display an image?
 
Abhishek Mehta
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, thanks for the showing interest.

let me explain my senario. There is a application regarding conference, and on each page i have to insert an image depending on a parameter which is passed. Now i can't make any changes on the servlet running on server, so i used a Servlet Filter which get parameter from the request and according to that display image before the page get loaded as i want the image to be displayed at left top of the page.

But of the of the page contain frameset that creates the problem, the image from the filter get displayed but not the page content if i invoked filter before the page. and invoked after, then no problem.

here i am giving the code of Servlet Filter.


One solution is there i guess it works but don't know how to do that.
cant we put some condition in web.xml using regular expression, which will invoke filter for all pages except the page which contain frameset.

Please help me out from this problem
Thanks
Abhishek
 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Abhishek Mehta:
One solution is there i guess it works but don't know how to do that.
cant we put some condition in web.xml using regular expression, which will invoke filter for all pages except the page which contain frameset.



Abhishek - you can set the regular expression in the filter code itself. It could parse the HTML to see if it has any framesets in it. In fact, it might not even need to be a regex. It could simply be a case insensitive search for '<frameset'. But, I suspect, over time you will see cases where you may need to tweak it. So, you could start with a regex. Check out Jakarta ORO for your regex needs.

Hope this helps.
 
reply
    Bookmark Topic Watch Topic
  • New Topic