Throw a javascript pop up window from Servlet
1 posts in topic
Flat View  Flat View

Posted By:   prateek_saxena
Posted On:   Friday, June 7, 2002 08:27 AM

I am looking for a solution where i want to throw a javascript message box from the servlet which already has got a response(it redirects to a JSP and i dont want to change the JSP page as my application has got the tons of JSPs but only 1 servlet. ) means i dont want to touch the response of the servlet but at the same time i want to throw a message ( not a HTML page).

How is it possible . Is it possible by Server side javascript.I searched quite few website but didnt get anything.

Could anyone answer my qs as it is very urgent.


Re: Throw a javascript pop up window from Servlet

Posted By:   Lasse_Koskela  
Posted On:   Monday, June 10, 2002 05:49 AM

Basically you must create the JavaScript invoking the message box in the JSP's, unless you're just including JSP's into a single servlet's control flow.

So, the problem seems to be that you don't want to add the out.println's into each of the JSP files? I'm afraid you have to (by all means, correct me if I'm wrong).

I think you should write some kind of a generic collection class for passing a set of JavaScript blocks into the JSP's, which in turn would always call a simple (single?) method for writing the JavaScripts into the resulting HTML.

This way you wouldn't need to specify the imported JavaScripts within the JSP files, but instead in the controlling servlet.

I have really no clue whether this is feasible or not. Just an idea.

About | Sitemap | Contact