You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vikrama Sanjeeva <vi...@gmail.com> on 2005/12/21 19:53:32 UTC

Problem in
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?

Bye,
Viki

Re: Problem in Posted by Rahul Akolkar <ra...@gmail.com>.
On 12/24/05, Vikrama Sanjeeva <vi...@gmail.com> wrote:
> Hi,
>
>  Yes, it's working now with <html:base/>. When I click calendar icon (img)
> it displays correct. This calendar is in Javascript and has next year, next
> month, privious year, previous month buttons. When i click any one of the it
> says "page cannot be found: Http 400 error".
>
<snip/>

Sounds rather like a 404 to me.


>  Again, it is relative path problem?
>
<snap/>

I'd say. I don't think we have any details about what the buttons are
doing, but this may help as well:

http://www.w3.org/TR/REC-html40/struct/links.html#h-12.4

-Rahul

P.S.- <OT>Didn't Michael have a page on the wiki about this? I'm not
good at navigating the Struts wiki in order to find stuff, there are
probably some "conventions" I'm not aware of?</OT>


> Bye,
> Viki.
>
> On 12/23/05, Laurie Harper <la...@holoweb.net> wrote:
<snip/>
> > >>
> > >> [1]
> > >>
> > http://struts.apache.org//struts-doc-1.2.8/userGuide/struts-html.html#base
> > >>
> > >>
<snap/>

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


Re: Problem in Posted by Vikrama Sanjeeva <vi...@gmail.com>.
Hi,

  Yes, it's working now with <html:base/>. When I click calendar icon (img)
it displays correct. This calendar is in Javascript and has next year, next
month, privious year, previous month buttons. When i click any one of the it
says "page cannot be found: Http 400 error".

  Again, it is relative path problem?

Bye,
Viki.

On 12/23/05, Laurie Harper <la...@holoweb.net> wrote:
>
> 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 <la...@holoweb.net> 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: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Problem in Posted by Laurie Harper <la...@holoweb.net>.
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 <la...@holoweb.net> 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: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 


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


Re: Problem in Posted by Vikrama Sanjeeva <vi...@gmail.com>.
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."

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?

Bye,
Viki.

On 12/22/05, Laurie Harper <la...@holoweb.net> 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Problem in Posted by Laurie Harper <la...@holoweb.net>.
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org