hi Stephen,

thank you for your solution.

But if i'm not mistaken your example needs
no session (therefor the redirection, right?)

Then it's no problem to have one frame
making the Request and the Servlet after
doing its job redirects to the URL with the
Frameset.

But i need session-support for the whole Lifetime
of the WebApplication, so thats my abstract use-case:

request (for instance form-data) from one frame, servlet
validates and changes some Java-Objects, putting them
back to session, then _dispatching_ , better _forwarding_
the request to the frameset.
because the frameset consists of several "JSP-Frames", whitch all
needs access to the session-object, i can not dispatch to the
frameset, instead i have to dispatch to that frame, which has made the
request (with help from a JavaScript-Function).

Am I wrong?

here some code-snippets:

frame with form, action as a redirection to a JavaScript-Function:
<form method="post" ... action="javascript:dispatchFrames('Servlet-Path')">
....
....
<sript language = ...>
function dispatchFrames(servletpath){
/* reading form-parameters etc.
    then dispatching for that frames who need access to modified
session-object:
*/
parameterlist=.....
....
parent.frames[0].location.href=servletpath+"?"+parameterlist;
parent.frames[1].location ...same
... and so on

Servlet:
/* doGet() + doPost(): */
...public void doIt(...) ...
/* get my Object from Session: */
object = (cast)session.getSessionAttribute(..);
/* changing the object acording to request-parameters */
/* no explicit store back, because call by reference */
/* dispatch to that file(jsp), the requesting frame should display now: */
RequestDispatcher rd = getServletContext().getRequestDispatcher(url);
try{
...
...
res.setHeader(...
rd.forward(req,res);
....

this is my solution, witch work also with session-suport for frames,
but i'm not very happy with it.

bAs T.

----- Original Message ----- 
From: Jones, Stephen <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 21, 2001 6:51 PM
Subject: RE: best way to handle Servlets+JSPs+multiple Frames?


> In our product, we use forms to POST user input data. We usually send the
> input to another JSP page, but I don't see why this would not work for a
> servlet's doPost(HttpServletRequest, HttpServletResponse) method.
> 
> e.g.:
> <form name="ReqAttMod" id="ReqAttMod" method="POST"
> action="UserMod_Ctl.jsp" target="_top">
> <% /* form stuff here, buttons, textfields, etc */ %>
> </form>
> 
> When the servlet has made its controller-decisions, it then performs a
> URL-redirect to the new HTML frameset desired (sURL), according to biz
> logic, e.g.:
> 
> response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
> response.setHeader("Location", sURL);
> 
> (this is a cookie-safe redirect)
> 
> I'm sure there are other ways, as well.
> Steve
> 
> -----Original Message-----
> From: Sebastian Schulz [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 21, 2001 10:07 AM
> To: [EMAIL PROTECTED]
> Subject: best way to handle Servlets+JSPs+multiple Frames?
> 
> 
> hi,
> 
> i want to develop a WebApplication
> using Servlets+JSPs+JavaBeans.
> (MVC)
> 
> So far no problems.
> 
> But on client-side i need a frame-based solution.
> Every Frame itself is a JSP. The following i need to 
> get working as smart as possible:
> 
> User-action at one Frame causes the Servlet to change
> this but also all the other JSP-Frames acording to the
> current action.
> 
> I know i can do this by including a JavaScript-Function
> which produces a request for every Frame to the Servlet.
> 
> This sucks because of:
> - i need JavaScript
> - it is not smart and will lead to bad performance because of multiple, 
>   redundant requests
> - it is quite dangerous for some (altering) operations, which 
>   shold take place only one times!
> 
> so i would be very glad, if someone have a more elegant solution!
> may be there is a "best way" for this kind of problem...
> thanks in advance.
> 
> bAs T.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to