You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by James Howe <jw...@allencreek.com> on 2001/02/14 22:07:25 UTC

A couple more frames (and non-frames) questions

I have a couple more questions regarding Struts and frames as well as a 
question concerning web site organization.

I was able to get my frames-based Struts application to sort of work after 
adding the "target" property to my logon form.  This leads to my next 
question.  My current page has the Navigation frame, the body frame and the 
footer frame.  I had made my footer a jsp which was design to display 
information based on who the user logged in as.  Before the user logs in, 
the foot is basically blank.  I present the logon screen.  Once the user 
logs on, I want to display a new page in the body frame, but I also want 
the footer to update.  Unfortunately, it appears that when the logon form 
finishes transferring to the "success" page, only the body frame 
updates.  (Not that this should be too surprising).  My question is, how 
can I get the footer frame to update as well?  Can I programatically get 
other frames to update when an action occurs?  Or do I just need to 
restructure how my page works?

Related to the above, the current structure of my web application has some 
pages at the root level and some in subdirectories.  For example, my 
logon.jsp is in the root, but the jsp and html associated with the success 
action exists in a subdirectory.  When I logged into my application, I was 
able to most of the contents of my next page to display, but not 
everything.  I also had to tweak some of the paths in my html.  For 
example, previously I had a reference to a style sheet as 
"../style.css".  When the page was displayed, the style was not 
applied.  If I changed the reference to "style.css", the style was 
correctly applied.    However, my page also referenced an html file for one 
of its frames.  This page never appeared, and no error was displayed 
either.  I'm sort of confused as to where the system thinks it is after 
performing a forward action.  I'm sure I could get everything to work if I 
just put it all in the root directory, but I'm not sure that's what I want 
to do.  Can anyone offer any suggestions on good ways to organize Struts 
applications?

Thanks again.


Re: A couple more frames (and non-frames) questions

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
James Howe wrote:

> I'm sort of confused as to where the system thinks it is after
> performing a forward action.

This is one of the interesting wrinkles to using a RequestDispatcher (as Struts
does to implement the forwarding).  Because the client browser has no clue that
the forwarding took place, so by default relative URLs will be resolved based
on the URL of the action you submitted to (i.e.  something like
http://localhost:8080/myapp/action.do) rather than where the JSP page itself
is.

One approach that works, as you pointed out, was putting everything at the top
level of the URL hierarchy within your webapp.  Another option is to include
the

    <html:base/>

tag in the <head> section of your page.  This will generate a <base href="...">
element in the generated page, which will make relative addresses resolve
against the URL of the JSP page itself, not the action that forwarded to it.

Craig