Re: Action before loading a page

2001-06-05 Thread Roland Huss

Peter Alfors <[EMAIL PROTECTED]> writes:

> I don't think that you have control of when the frames are loading. The browser
> attempts to load both frames simultaneously. (Please correct me if I am wrong)
> Therefore, you would have to do something kinda funky (javascript) to instruct
> another frame to 'reload' after the current frame finishes.
> If you cannot gaurantee that your users have javascript enabled, you will
> probably want to avoid it.

Right. To be more concrete, in your first frame your tag could create
for example an 'onload'-handler, which updates your second frame with
an request to an action (probably with extra parameters appended).

However, I vote for Petes suggestion to put an action in front of your
frameset. This action could fetch all your data, put it into the
request and let your tags render the results. It seems to me always a
good idea to use action for bussines logic (e.g. database lookups) and
tags for visual rendering only (drop down list with the results from the
action). 

cu...
-- 
...roland huss
 consol.de



Re: Action before loading a page

2001-06-05 Thread Ted Husted

Both JSPs and Actions are called by a HTTP request. It can be helpful to
think of Actions as "invisible pages" that respond to a request with a
"visible page". 

Any place where you request (or "load") a page, you can request an
Action instead. So however you "load another file in the second frame",
you should be able to request an Action instead. Your tag might also
include the database ID as part of the request (/Action.do?ID=XXX), so
you don't have to bother with the session. 

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.
-- http://www.husted.com/about/struts/


Jack Xu wrote:
> 
> I have a frameset of 2 frames. The first frame loads a JSP file containing a
> custom tag. The tag retrieves a list from my database and displays it as a
> drop down list. The tag then marks the first entry in the list as default
> and then load another file in the second frame. In stead of having a static
> welcome page in the second frame, I'm wondering if there's any way to
> perform this:
> 
> 1. The custom tag finishes in the first frame. It puts some kind of ID in
> the session.
> 2. Before the second frame loads, a struts action is executed. The action
> retrieves information from my database based on the ID the custom tag put in
> the session, construct a form containing the information returned from the
> database and forwards to the JSP page to be loaded to the second frame. The
> JSP load info from the form so that I have default page with information
> loaded from the database.
> 
> Your help is very much appreciated !
> 
> --
> Jack Xu
> 
> March Networks
> (416)977-7007 x 308
> Email: [EMAIL PROTECTED]
> --



Re: Action before loading a page

2001-06-05 Thread Peter Alfors

I don't think that you have control of when the frames are loading. The browser
attempts to load both frames simultaneously. (Please correct me if I am wrong)
Therefore, you would have to do something kinda funky (javascript) to instruct
another frame to 'reload' after the current frame finishes.
If you cannot gaurantee that your users have javascript enabled, you will
probably want to avoid it.

A couple of thoughts...

Instead, maybe you could use an action for both frames...  Have them call a
utility class that generates a static ID.
Then each action will be able to share the same ID and perform the desired tasks
using it?
- Or -
Your welcome page could be a single frame that calls an action.  The action
could generate the ID you want, then forward to a frameset page that loads the
JSP page with the drop down list, and the action you mentioned below.

HTH,
Pete


Jack Xu wrote:

> I have a frameset of 2 frames. The first frame loads a JSP file containing a
> custom tag. The tag retrieves a list from my database and displays it as a
> drop down list. The tag then marks the first entry in the list as default
> and then load another file in the second frame. In stead of having a static
> welcome page in the second frame, I'm wondering if there's any way to
> perform this:
>
> 1. The custom tag finishes in the first frame. It puts some kind of ID in
> the session.
> 2. Before the second frame loads, a struts action is executed. The action
> retrieves information from my database based on the ID the custom tag put in
> the session, construct a form containing the information returned from the
> database and forwards to the JSP page to be loaded to the second frame. The
> JSP load info from the form so that I have default page with information
> loaded from the database.
>
> Your help is very much appreciated !
>
> --
> Jack Xu
>
> March Networks
> (416)977-7007 x 308
> Email: [EMAIL PROTECTED]
> --


begin:vcard 
n:;
x-mozilla-html:FALSE
org:http://www.irista.com/logo/irista.gif";>Bringing Vision to Your Supply Chain
adr:;;
version:2.1
end:vcard