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.
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
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.