tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brett Knights" <br...@knightsofthenet.com>
Subject RE: best way to handle Servlets+JSPs+multiple Frames?
Date Wed, 21 Feb 2001 21:23:23 GMT
You can target any frame for the result to go to in your form tag

e.g.
<form target="frameName"..

then for any other frames that need refreshing have a javascript function that refreshes them
when the form's target frame is done
loading.

e.g. in the html returned to "frameName"
<body onLoad="refreshOthers('myFrameName');"...

where refreshOthers is a function in the parent window that knows which frames should be updated
when a new frame is returned.
e.g. frameB.location="myservlet?infoFor=frameB"

All the refreshes should just be able to use sessions normally since the original post will
have updated the session and returned
when the other pages get refreshed.

Does this help?

> -----Original Message-----
> From: Sebastian Schulz [mailto:sebastian.schulz@sebastian-schulz.com]
> Sent: Wednesday, February 21, 2001 11:10 AM
> To: tomcat-user@jakarta.apache.org
> Subject: Re: best way to handle Servlets+JSPs+multiple Frames?
>
>
> 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 <sjones@rational.com>
> To: <tomcat-user@jakarta.apache.org>
> 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:sebastian.schulz@sebastian-schulz.com]
> Sent: Wednesday, February 21, 2001 10:07 AM
> To: tomcat-user@jakarta.apache.org
> 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: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, email: tomcat-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, email: tomcat-user-help@jakarta.apache.org



Mime
View raw message