Hi Craig,

Thanks for your response. Unfortunately, it still doesn't work.  I tried 
two different approaches: with the <html:base/> tag and without it, and I 
get the same result in both cases:

         I code the following link:

                 <html:link 
page="/jsp/prodinfo/prodinfo.jsp">Introduction</html:link>

         The html source (in the browser, Netscape 4.6.1 or IE 4.72) shows:

                 When I use the <html:base/> tag:

                         <base 
href="http://localhost:8080/backup/jsp/prodinfo/prod-info.jsp";>   in the 
HTML head section, and

                 The link is generated as:

                         <a 
href="/backup/jsp/prodinfo/prodinfo.jsp">Introduction</a>    as the href link

         When I mouse over the link in the browser, the status line at the 
bottom of the browser window displays:

                 http://localhost:8080/backup/jsp/prodinfo/prod-info.jsp

         When I click the link, I get the following in the browser window:

                 Not Found (404)
                 Original request: /backup/jsp/prodinfo/prodinfo.jsp

                 Not found request: /backup/jsp/prodinfo/prodinfo.jsp

Am I doing something wrong?  Must be, since you use this approach all the 
time.  Thanks again for your help.  It is greatly appreciated.

Rick Horowitz


At 09:59 AM 6/14/01 -0700, you wrote:


>On Wed, 13 Jun 2001, Rick Horowitz wrote:
>
> > Hi,
> >
> > I'm trying to use href links with Struts templates, and can't figure out
> > how to make my href links work properly.  [Templates seem to work just
> > fine, otherwise.]... my compliments.
> >
> > 1. I want to use Struts <html:link> tags so that to automatically do URL
> > session encoding.
> >
>
>Struts does this automatically for you.
>
> > 2. I want to use absolute URLs to make coding of urls more robust. For
> > example, if I have a directory structure of JSPs:
> >          jsp
> >          jsp/prodinfo
> >          jsp/faq
> >       ...I want to be able to code the url something like...
> > jsp/faq/faq1.jsp or jsp/prodinfo/info1.jsp, in case I change the directory
> > structure, rather than using relative links, e.g. ../faq/faq1.jsp.
> >
>
>I have found it best to use context-relative URLs starting with a
>"/" character throughout my applications, rather than trying to use
>relative links -- for the reasons that you are probably familiar with.  To
>do that for links, use the "page" attribute to specify the destination --
>Struts will prepend the context path of the current application for you,
>so that the browser always goes the right place.  For example, you might
>code:
>
>     <html:link page="/jsp/faq/faq1.jsp">To the FAQ</html:link>
>
> > 3. For the portion of the website that I'm currently working on, I am
> > creating href links from one JSP to other JSPs.  [For other portions of 
> the
> > website, I will be using an MVC architecture, hence forwarding from a
> > servlet to a JSP and vice versa.]
> >
>
>It works either way, but remember that links directly from one page to
>another bypasses the controller -- and therefore bypasses the stuff that
>the controller servlet does for you.
>
>
> > 4. I have tried various approaches to using the <html:base/> tag in the
> > HTML <HEAD> section of my Struts template file, not using a base tag, and
> > have tried using the following to set the html base:
> >          <BASE HREF="<%= "http://";
> >                  +request.getServerName() +":"
> >                  +request.getServerPort()
> >                  +request.getContextPath() %>/" >
> >       Although the latter works with regular <a href > tags, it does not
> > seem to work with <html:link> Struts tags.
> >
>
>See the <html:base/> tag for a way to do this automatically.
>
>However, whether you create it yourself or not, the <base> element affects
>only relative hyperlinks.  If you follow my suggestion above (always use
>context-relative links), you won't need it.
>
> > I have tried a variety of combinations of these base tags with a 
> variety of
> > combinations of url encodings, but cannot seem to get them to work --
> > except with regular <a href> tags using the
> >          <BASE HREF="<%= "http://";
> >                  +request.getServerName() +":"
> >                  +request.getServerPort()
> >                  +request.getContextPath() %>/" >
> >          base tag setting.
> >
> > Thank you in advance to anyone who can help,
> >
> > --------------------
> > Rick Horowitz
> >
> >
>
>Craig

--------------------
Rick Horowitz

Reply via email to