Vikrama Sanjeeva wrote:
Hi,

      The "myForm.jsp" is called when a user clicks a link in another JSP.
Here is the flow:

1. User click the link in "home.jsp" .

<html:link page="/do/SetUpMyForm">My Form</html:link>

2. Action, "SetUpMyForm" is called and it actually set's up some variables,
pull-down menues and then it "return (mapping.findForward("
continueCallingMyForm.jsp"));"

  I think this is what you said here:

"If you're calling an action which forwards to the JSP page, the browser
doesn't know the physical location of the JSP and will resolve relative URLs
with respect to the actionpath, not the JSP path."

Right; as far as the browser knows, the relative path 'img.gif' means '/do/img.gif', since the path is relative to the URL '/do/SetUpMyFrom'.

I've read the html:base tag, but it's not clear to me how to use this tag in
calling <img src="img.gif"> Can you give any related example?

You don't use it as part of constructing the img tag. It goes in the 'head' section of your page. I.e. you need something like

  <head>
    <html:base/>
    ...
  </head>

The result is an HTML 'base' tag that tells the browser the URL to use as the base for relative paths, which should make your img tag behave as you expect.

L.

Bye,
Viki.

On 12/22/05, Laurie Harper <[EMAIL PROTECTED]> wrote:
Vikrama Sanjeeva wrote:
Hi,

  I've "img.gif" and and "myForm.jsp" in same folder. But when I call
the "
img.gif" with following path, it does not display in myForm.jsp. here it
is:
<html:text property="date" ></html:text>
                                <img src="img.gif" id="f_trigger_c"
style="cursor: pointer; border: 1px solid red;" title="Date selector"
      onmouseover="this.style.background='red';" onmouseout="
this.style.background=''" />

But when I call with src="../img.gif", it works. Here it is:

<html:text property="date" ></html:text>
                                <img src="../img.gif" id="f_trigger_c"
style="cursor: pointer; border: 1px solid red;" title="Date selector"
      onmouseover="this.style.background='red';" onmouseout="
this.style.background=''" />

Why it so? Some url related problem?
How do you reference your JSP? If you're calling an action which
forwards to the JSP page, the browser doesn't know the physical location
of the JSP and will resolve relative URLs with respect to the action
path, not the JSP path.

You might want to look at the html:base tag [1] to help with this; it
allows you to tell the browser what base path to use for resolving
relative URLs in the page.

L.

[1]
http://struts.apache.org//struts-doc-1.2.8/userGuide/struts-html.html#base


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





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

Reply via email to