Re: Context relative URL
looks like a basic javascript question to me but here goes anyway. Stop trying to put everything in the event context = c:url value=/ /; imgdir = context + /images/; //perhaps create an array to preload. images = [inico]; function mover(name) { document.images[name].src = imgdir + name +-over.gif; } function mout(name) { document.images[name].src = imgdir + name +.gif; } html:link page=/foo.do linkName=inicio onmouseover=mover('inicio') onmouseout=mout('inicio') .. On 16 Mar 2004, at 08:00, [EMAIL PROTECTED] wrote: Try using html:rewrite page='/images/inicial.gif'/ Subramaniam Olaganthan Tata Consultancy Services Mailto: [EMAIL PROTECTED] Website: http://www.tcs.com Joao Batistella [EMAIL PROTECTED] 03/16/2004 12:35 AM Please respond to Struts Users Mailing List [EMAIL PROTECTED] To 'Struts Users Mailing List' [EMAIL PROTECTED] cc Subject Context relative URL Hello! I have the following HTML img tag: html:img page=/images/inicial.gif border=0 onmouseover=this.src='/images/inicio-over.gif' onmousedown=this.src='/images/inicio-down.gif' onmouseout=this.src='/images/inicio.gif'/ The problem is that the page attribute is ok, img tag add the app context before de page attribute and the image appears. But the others images in the javascript events dosn't appear because struts doesn't put the app context before the address. I got the following HTML: img src=/myapp/images/inicio.gif border=0 onmouseover=this.src='/images/inicio-over.gif' onmouseout=this.src='/images/inicio.gif' onmousedown=this.src='/images/inicio-down.gif' How can I have this generated with all the images with myapp before the source of the image? Like this: img src=/myapp/images/inicio.gif border=0 onmouseover=this.src='/myapp/images/inicio-over.gif' onmouseout=this.src='/myapp/images/inicio.gif' onmousedown=this.src='/myapp/images/inicio-down.gif' Thanks, JP ForwardSourceID:NT6182 InterScan_Disclaimer.txt- 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]
Context relative URL
Hello! I have the following HTML img tag: html:img page=/images/inicial.gif border=0 onmouseover=this.src='/images/inicio-over.gif' onmousedown=this.src='/images/inicio-down.gif' onmouseout=this.src='/images/inicio.gif'/ The problem is that the page attribute is ok, img tag add the app context before de page attribute and the image appears. But the others images in the javascript events dosn't appear because struts doesn't put the app context before the address. I got the following HTML: img src=/myapp/images/inicio.gif border=0 onmouseover=this.src='/images/inicio-over.gif' onmouseout=this.src='/images/inicio.gif' onmousedown=this.src='/images/inicio-down.gif' How can I have this generated with all the images with myapp before the source of the image? Like this: img src=/myapp/images/inicio.gif border=0 onmouseover=this.src='/myapp/images/inicio-over.gif' onmouseout=this.src='/myapp/images/inicio.gif' onmousedown=this.src='/myapp/images/inicio-down.gif' Thanks, JP
Re: Context relative URL
Hi JP: I believe you can use html:rewrite for this. As in: onmouseover=this.src='html:rewrite page=/images/inicio-over.gif /' etc. Hope this helps, Geeta Joao Batistella wrote: Hello! How can I have this generated with all the images with myapp before the source of the image? Like this: img src=/myapp/images/inicio.gif border=0 onmouseover=this.src='/myapp/images/inicio-over.gif' onmouseout=this.src='/myapp/images/inicio.gif' onmousedown=this.src='/myapp/images/inicio-down.gif' Thanks, JP - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Context relative URL
Try using html:rewrite page='/images/inicial.gif'/ Subramaniam Olaganthan Tata Consultancy Services Mailto: [EMAIL PROTECTED] Website: http://www.tcs.com Joao Batistella [EMAIL PROTECTED] 03/16/2004 12:35 AM Please respond to Struts Users Mailing List [EMAIL PROTECTED] To 'Struts Users Mailing List' [EMAIL PROTECTED] cc Subject Context relative URL Hello! I have the following HTML img tag: html:img page=/images/inicial.gif border=0 > > > The problem is that the page attribute is ok, img tag add the app context before de page attribute and the image appears. But the others images in the _javascript_ events dosn't appear because struts doesn't put the app context before the address. I got the following HTML: img src="" border=0 > How can I have this generated with all the images with myapp before the source of the image? Like this: img src="" border=0 > Thanks, JP ForwardSourceID:NT6182 DISCLAIMER: The information contained in this message is intended only and solely for the addressed individual or entity indicated in this message and for the exclusive use of the said addressed individual or entity indicated in this message (or responsible for delivery of the message to such person) and may contain legally privileged and confidential information belonging to Tata Consultancy Services. It must not be printed, read, copied, disclosed, forwarded, distributed or used (in whatsoever manner) by any person other than the addressee. Unauthorized use, disclosure or copying is strictly prohibited and may constitute unlawful act and can possibly attract legal action, civil and/or criminal. The contents of this message need not necessarily reflect or endorse the views of Tata Consultancy Services on any subject matter. Any action taken or omitted to be taken based on this message is entirely at your risk and neither the originator of this message nor Tata Consultancy Services takes any responsibility or liability towards the same. Opinions, conclusions and any other information contained in this message that do not relate to the official business of Tata Consultancy Services shall be understood as neither given nor endorsed by Tata Consultancy Services or any affiliate of Tata Consultancy Services. If you have received this message in error, you should destroy this message and may please notify the sender by e-mail. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Re: Construct context-relative URL in Javascript?
I don't want the result in an a href. I want to do a POST and I want to be able to set the TARGET attribute for the FORM before posting as well. I want to set the form's ACTION attribute to that value. But I have multiple values that the form's ACTION attribute might get set to and so I have to do it in Javascript based on which button the user clicked on. Not sure I completely understand but it sounds like html:rewrite is what you're looking for. It rewrites a URI and writes the output directly into your page. For example, I have in my code: input type=button value=Detailed View onClick=detail('html:rewrite forward=detail_window/') So when this button is pushed, the JavaScript detail() function is called with the correct URI for the detail_window action passed as a parameter. Devon
Re: Construct context-relative URL in Javascript?
On Wed, 8 Aug 2001 17:47:22 -0500, [EMAIL PROTECTED] wrote: Did you try html:base/? How can that help? I don't want the result in an a href. I want to do a POST and I want to be able to set the TARGET attribute for the FORM before posting as well. I want to set the form's ACTION attribute to that value. But I have multiple values that the form's ACTION attribute might get set to and so I have to do it in Javascript based on which button the user clicked on. The html:base looks like will calc the right absolute URL and I could create one for each button. But I'd have to make them invisible (since I don't want to the user clicking on them) and then have some way to get at their HREF attribute value. In theory that may be possible using DOM calls from Javascript if I set ID values for each A HREF element. But that's limit what browser versions could be used. So I'd rather have the values be placed in invisible controls by the server when it generates the page.
Construct context-relative URL in Javascript?
I've seen Craig posted how something like html:image page=/images/a.gif/ will get translated to img src=/myapp/images/a.gif But I need to create a context-sensitive URL in Javascript. The reason for this is that there are multiple buttons on my form/page and in the action handler function for each button I need to set the form's action to the appropriate action for that button click before submitting the form. So I think I want a way to do get at info in Javascript that is the equivalent of what is returned by javax.servlet.http.HttpServletRequest req.getContextPath() So that something like this can be done in Javascript this.form.action = contextPath + /graphs/fullgraph.jsp (or .do instead of .jsp or whatever) So is there some way with a Struts tag to put the context path on the generated page using perhaps an invisible control that would be set to have the context path as its value? Then one could assign the invisible control's value for the the context path to a Javascript variable and use it in something like the code snippet above. I also need to do some other stuff in the Javacsript (eg set the target attribute of the form tag using a generated value as well). So I think I really need to use Javascript to do this. Or am I approaching the problem in a way that is totally wrong?
Re: Construct context-relative URL in Javascript?
Did you try html:base/? Randall Parker To: [EMAIL PROTECTED] [EMAIL PROTECTED] randall2@nlscc: .netSubject: Construct context-relative URL in Javascript? 08/08/2001 05:23 PM Please respond to struts-user I've seen Craig posted how something like html:image page=/images/a.gif/ will get translated to img src=/myapp/images/a.gif But I need to create a context-sensitive URL in Javascript. The reason for this is that there are multiple buttons on my form/page and in the action handler function for each button I need to set the form's action to the appropriate action for that button click before submitting the form. So I think I want a way to do get at info in Javascript that is the equivalent of what is returned by javax.servlet.http.HttpServletRequest req.getContextPath() So that something like this can be done in Javascript this.form.action = contextPath + /graphs/fullgraph.jsp (or .do instead of .jsp or whatever) So is there some way with a Struts tag to put the context path on the generated page using perhaps an invisible control that would be set to have the context path as its value? Then one could assign the invisible control's value for the the context path to a Javascript variable and use it in something like the code snippet above. I also need to do some other stuff in the Javacsript (eg set the target attribute of the form tag using a generated value as well). So I think I really need to use Javascript to do this. Or am I approaching the problem in a way that is totally wrong?