Re: forcing relative urls from struts instead of the absolute urls!
Max Cooper wrote: It sounds like your main challenge is that you have requests to a web server that look like http://web.domain.com/foo/bar/me mapped to an app deployed on an app server that you might access directly as http://app.domain.com/me. The app will make site-root relative URLs like /me/foo.html, and the browser will them make a request to the web server like http://web.domain.com/me/foo.html which is not what you want. That is correct. (I don't have the original message, so I answer to this one) I have similar problem like you. Applications are deployed as http://app1.domain.com/ and http://app2.domain.com/ for production use, and developers deploy them to local Tomcats as http://localhost:8080/app1/ and http://localhost:8080/app2/. I found the solution in tag, since it will convert the relative path in JSP to the absolute one. It also does the URL-rewriting, but I don't mind that. Did anyone else try this solution? Ognjen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: forcing relative urls from struts instead of the absolute urls!
On Tue, 2006-01-03 at 16:51 -0500, Michael P. Soulier wrote: > On 13/12/05 Max Cooper did say: > > > It sounds like your main challenge is that you have requests to a web > > server that look like http://web.domain.com/foo/bar/me mapped to an app > > deployed on an app server that you might access directly as > > http://app.domain.com/me. The app will make site-root relative URLs > > like /me/foo.html, and the browser will them make a request to the web > > server like http://web.domain.com/me/foo.html which is not what you > > want. > > That is correct. > > > What is stopping you from deploying the app with a "/foo/bar/me" > > context, so that it matches the "public" context on the web server? This > > is almost certainly the easiest solution if you can do it. > > In this case, http://web.domain.com/foo is a prefix for a lot of UI > elements that are pluggable for separate applications. That would mean > that if /foo became a web application in tomcat, it would be much more > difficult for applications to plug-in to it. If each application > delivered a .war file, as a separate web application, that would be far > easier to maintain in the long run than requiring all developers to > coexist in one large web app under tomcat. I am not following why you can't make the "context path" (whether it is a webapp or not) the same on your app server as it is on the web server, e.g. http://web.com/foo --proxy--> http://app.com/foo, rather that http://web.com/foo --proxy--> http://app.com/something/else. This really would solve all of your problems -- perhaps it is worth further consideration, even if you have to change some paths to make it work. Note that I think you can deploy completely separate webapps to the following seemingly-nested paths, if this is the problem: /foo /foo/bar /foo/bar/baz Or how about setup another virtual host on tomcat, with the app (or whatever it is) deployed with a context path that matches the path on the public web server. > > Alternately, perhaps there is some proxy configuration magic that would > > work. To be robust, you'd probably need to use a connector (e.g. mod_jk) > > rather than just using a "dumb" proxy to forward requests, because I > > think the app server really needs to know the desired context path in > > order to render the pages with the proper URLs. (The alternative of > > filtering the response stream after-the-fact in hopes of converting all > > URLs is a lousy design for many reasons and not an approach I would > > recommend.) > > I'm currently using ProxyPass in apache, but if this can be done with > mod_jk, then I'll focus on that. Do you know it's possible with AJP? I was hoping that I would see config items to address this, but I didn't see any when reviewing the docs. I guess it doesn't do it, at least not alone. Maybe it could be combined with mod_rewrite in some novel way to solve this problem, but I don't know how to do it. I do like using mod_jk (and similar for components other app servers) since they handle things (e.g. redirect URLs) that can be a pain to setup in a proxy and/or pain to work around with app code. Basically, they give you a solid base to build on, without a bunch of surprising proxy-related gotchas to work around in the app code. Be a little more specific about your situation -- I think that might help someone recognize a problem they had and offer you a solution. You can obviously obscure the particulars while still communicating the structure of your problem in sufficient detail. So far, I don't really get what your situation is beyond "path on web server doesn't match context path on app server". -Max - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: forcing relative urls from struts instead of the absolute urls!
On 13/12/05 Max Cooper did say: > It sounds like your main challenge is that you have requests to a web > server that look like http://web.domain.com/foo/bar/me mapped to an app > deployed on an app server that you might access directly as > http://app.domain.com/me. The app will make site-root relative URLs > like /me/foo.html, and the browser will them make a request to the web > server like http://web.domain.com/me/foo.html which is not what you > want. That is correct. > What is stopping you from deploying the app with a "/foo/bar/me" > context, so that it matches the "public" context on the web server? This > is almost certainly the easiest solution if you can do it. In this case, http://web.domain.com/foo is a prefix for a lot of UI elements that are pluggable for separate applications. That would mean that if /foo became a web application in tomcat, it would be much more difficult for applications to plug-in to it. If each application delivered a .war file, as a separate web application, that would be far easier to maintain in the long run than requiring all developers to coexist in one large web app under tomcat. > Alternately, perhaps there is some proxy configuration magic that would > work. To be robust, you'd probably need to use a connector (e.g. mod_jk) > rather than just using a "dumb" proxy to forward requests, because I > think the app server really needs to know the desired context path in > order to render the pages with the proper URLs. (The alternative of > filtering the response stream after-the-fact in hopes of converting all > URLs is a lousy design for many reasons and not an approach I would > recommend.) I'm currently using ProxyPass in apache, but if this can be done with mod_jk, then I'll focus on that. Do you know it's possible with AJP? > Using context-relative references is really useful. Actions have the > same name (path) no matter what page you are working on. Images are > always "/img/..." (or whatever) without having to think twice what the > request URL was that caused the JSP you are editing to execute (note > that the request may not match the JSP file path). And you can choose > (and change) the context path at deployment time without breaking > anything. > > However, if you are dead set on using strictly relative references, you > may still be able to get it to work. I am pretty sure I have seen > work, for instance. Why don't you post > a specific example of something that isn't working for you. I tried that, but I couldn't get the existing web application to load once I'd made those changes. Perhaps I did it wrong. Mike -- Michael P. Soulier <[EMAIL PROTECTED]>, 613-592-2122 x2522 "Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction." --Albert Einstein - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: forcing relative urls from struts instead of the absolute urls!
Note that Struts isn't writing absolute URLs. As a webapp developer, you use "context-relative references" that Struts turns into "site-root relative" URLs. Here are examples of each type of reference, just so we are all on the same page: Relative: foo.html Site-root relative: /myapp/foo.html (And the special case of context-relative /foo.html inside an app, which then becomes /myapp/foo.html if you deploy this app with a /myapp context path.) Absolute: http://server.com/bar.html It sounds like your main challenge is that you have requests to a web server that look like http://web.domain.com/foo/bar/me mapped to an app deployed on an app server that you might access directly as http://app.domain.com/me. The app will make site-root relative URLs like /me/foo.html, and the browser will them make a request to the web server like http://web.domain.com/me/foo.html which is not what you want. What is stopping you from deploying the app with a "/foo/bar/me" context, so that it matches the "public" context on the web server? This is almost certainly the easiest solution if you can do it. Alternately, perhaps there is some proxy configuration magic that would work. To be robust, you'd probably need to use a connector (e.g. mod_jk) rather than just using a "dumb" proxy to forward requests, because I think the app server really needs to know the desired context path in order to render the pages with the proper URLs. (The alternative of filtering the response stream after-the-fact in hopes of converting all URLs is a lousy design for many reasons and not an approach I would recommend.) Using context-relative references is really useful. Actions have the same name (path) no matter what page you are working on. Images are always "/img/..." (or whatever) without having to think twice what the request URL was that caused the JSP you are editing to execute (note that the request may not match the JSP file path). And you can choose (and change) the context path at deployment time without breaking anything. However, if you are dead set on using strictly relative references, you may still be able to get it to work. I am pretty sure I have seen work, for instance. Why don't you post a specific example of something that isn't working for you. -Max On Mon, 2005-12-12 at 13:52 -0500, Michael P. Soulier wrote: > Laurie Harper wrote: > > Because if they were relative Struts would have no way to know what they > > were relative *to*? > > But why does it need to know? I have links in sites that I look after like > > foo/bar/bash.html > > If I access this via http://mybox.com/, then the browser does the right > thing. If it's accessed via http://otherbox.com/, then it still does the > right thing. That's why relative links are always recommended. > > Why does Struts need to know? This seems like another case of a > shortsighted framework to me, complicating something that would be dead > simple if we were simply generating our own html. > > > Maybe inputPattern and/or pagePattern are what you're looking for? > > > > http://struts.apache.org/struts-doc-1.2.7/userGuide/configuration.html#controller_config > > > > Maybe. I'll look at this, and thank you. > > Please pardon my exasperation. > > Mike > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: forcing relative urls from struts instead of the absolute urls!
Laurie Harper wrote: Because if they were relative Struts would have no way to know what they were relative *to*? But why does it need to know? I have links in sites that I look after like foo/bar/bash.html If I access this via http://mybox.com/, then the browser does the right thing. If it's accessed via http://otherbox.com/, then it still does the right thing. That's why relative links are always recommended. Why does Struts need to know? This seems like another case of a shortsighted framework to me, complicating something that would be dead simple if we were simply generating our own html. Maybe inputPattern and/or pagePattern are what you're looking for? http://struts.apache.org/struts-doc-1.2.7/userGuide/configuration.html#controller_config Maybe. I'll look at this, and thank you. Please pardon my exasperation. Mike -- Michael P. Soulier <[EMAIL PROTECTED]>, 613-592-2122 x2522 Linux applications development "...the word HACK is used as a verb to indicate a massive amount of nerd-like effort." -Harley Hahn, A Student's Guide to Unix smime.p7s Description: S/MIME Cryptographic Signature
Re: forcing relative urls from struts instead of the absolute urls!
Michael P. Soulier wrote: Michael Jouravlev wrote: Links to what? To action or to JSP page? A form action, primarily. I don't think that references below answer your question, but they contain valuable info anyway: No, I'm afraid that they don't. I don't need a tag lib to put a tag in the html, but that won't fix the problem that struts, for some inane reason, _requires_ absolute URLs in its config! Why why why?? Because if they were relative Struts would have no way to know what they were relative *to*? Maybe inputPattern and/or pagePattern are what you're looking for? http://struts.apache.org/struts-doc-1.2.7/userGuide/configuration.html#controller_config L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: forcing relative urls from struts instead of the absolute urls!
Michael Jouravlev wrote: Links to what? To action or to JSP page? A form action, primarily. I don't think that references below answer your question, but they contain valuable info anyway: No, I'm afraid that they don't. I don't need a tag lib to put a tag in the html, but that won't fix the problem that struts, for some inane reason, _requires_ absolute URLs in its config! Why why why?? Mike -- Michael P. Soulier <[EMAIL PROTECTED]>, 613-592-2122 x2522 Linux applications development "...the word HACK is used as a verb to indicate a massive amount of nerd-like effort." -Harley Hahn, A Student's Guide to Unix smime.p7s Description: S/MIME Cryptographic Signature
Re: forcing relative urls from struts instead of the absolute urls!
On 12/6/05, Michael P. Soulier <[EMAIL PROTECTED]> wrote: > Hello, > > I didn't find this in the archives, so I'll ask. > > I have a tomcat app deployed via proxypass from apache (2 in fact, a > double-proxy through 2 servers). It needs to use relative paths in its > links to ensure that the composed path is correct. Unfortunately struts > doesn't seem to want to use relative links. > > So, > 1. Is there a way to make it use a relative link instead of an absolute one? > 2. Is there a way to force a prefix on the link? Links to what? To action or to JSP page? > Basically, the tomcat app is deployed as application "me". Instead of > links like > > /me > > I want > > /foo/bar/me > > Is this possible? > > Thanks, > Mike I don't think that references below answer your question, but they contain valuable info anyway: http://struts.apache.org/struts-taglib/tagreference-struts-html.html#html:base http://wiki.apache.org/struts/StrutsTaglibHtmlBase You can roll out your own tag instead of standard if needed. Michael. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
forcing relative urls from struts instead of the absolute urls!
Hello, I didn't find this in the archives, so I'll ask. I have a tomcat app deployed via proxypass from apache (2 in fact, a double-proxy through 2 servers). It needs to use relative paths in its links to ensure that the composed path is correct. Unfortunately struts doesn't seem to want to use relative links. So, 1. Is there a way to make it use a relative link instead of an absolute one? 2. Is there a way to force a prefix on the link? Basically, the tomcat app is deployed as application "me". Instead of links like /me I want /foo/bar/me Is this possible? Thanks, Mike -- Michael P. Soulier <[EMAIL PROTECTED]>, 613-592-2122 x2522 Linux applications development "...the word HACK is used as a verb to indicate a massive amount of nerd-like effort." -Harley Hahn, A Student's Guide to Unix smime.p7s Description: S/MIME Cryptographic Signature
RE: REPOST: Relative URLs
: Thanks Erik. I guess when you get into the tags mood, you forget there's something called scriptlets :) -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 30, 2005 5:06 PM To: Struts Users Mailing List Subject: Re: REPOST: Relative URLs How about: <% String basePathVar = (String) application.getAttribute("myPathVar"); %> . . . Erik tarek.nabil wrote: > >Thanks everyone. I really like the idea of using a ServletContext >attribute, but I'm not using the EL, is there a way I can do that >without using the EL? > > >-Original Message- >From: Benedict, Paul C [mailto:[EMAIL PROTECTED] >Sent: Tuesday, March 29, 2005 6:26 PM >To: 'Struts Users Mailing List' >Subject: RE: REPOST: Relative URLs > >Erik, > >The problem may be that you are using JSP Tags, which are commonly >written to only output links to resources within your context. You may >want to simply think of writing plain old and tags and do it >yourself. > >-Original Message- >From: Erik Weber [mailto:[EMAIL PROTECTED] >Sent: Tuesday, March 29, 2005 9:18 AM >To: Struts Users Mailing List >Subject: Re: REPOST: Relative URLs > > >Can't you embed a ServletContext attribute (variable) in your links >using the EL? The attribute value could come from an init param and get >set at app startup. > >Erik > > >tarek.nabil wrote: > > > >>Hi everyone, >> >>I still can not find an answer to my question, so I thought I'd repost >>this and try to make it clearer. I really apreciate any help. >> >> >>How can I refer to resources that are outside my module in a way that >>will not mandate rewriting all the URLs in case I change the location >> >> >of > > >>my module in the hierarchy? >> >>My URL would look like >>http://server/my-application/my-module/doSomething.do >> >>And inside the JSP I need to refer to an image inside a folder >> >> >"images", > > >>for example, the absolute URL should be >> >>http://server/my-application/images/some-image.gif >> >>For that purpose, I can not always use the tag, cause some >> >> >of > > >>the images are background images. >> >>I thought about the tag, but >> >>I can not use the page attribute, cause it's only limited to resources >>inside the module. >> >>I can not use the href attribute, because I do not want to hardcode >>the application name. >> >>I can not use the forward attribute because I do not want to specify a >>forward for every image. >> >>Even for the images that are simple images and I can use the >> tag, I can not use the pageKey attribute, also because it's >>module relative and also because then I would need to all the images >>in the ApplicationResources.properties file. >> >>Thanks, >>Tarek Nabil >> >>- >>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] > > > > > > >--- >- >-- >Notice: This e-mail message, together with any attachments, contains >information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, >New Jersey, USA 08889), and/or its affiliates (which may be known >outside the United States as Merck Frosst, Merck Sharp & Dohme or MSD >and in Japan, as Banyu) that may be confidential, proprietary >copyrighted and/or legally privileged. It is intended solely for the >use of the individual or entity named on this message. If you are not >the intended recipient, and have received this message in error, please >notify us immediately by reply e-mail and then delete it from your >system. >--- >- >-- > >- >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]
Re: REPOST: Relative URLs
How about: <% String basePathVar = (String) application.getAttribute("myPathVar"); %> . . . Erik tarek.nabil wrote: Thanks everyone. I really like the idea of using a ServletContext attribute, but I'm not using the EL, is there a way I can do that without using the EL? -Original Message- From: Benedict, Paul C [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 29, 2005 6:26 PM To: 'Struts Users Mailing List' Subject: RE: REPOST: Relative URLs Erik, The problem may be that you are using JSP Tags, which are commonly written to only output links to resources within your context. You may want to simply think of writing plain old and tags and do it yourself. -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 29, 2005 9:18 AM To: Struts Users Mailing List Subject: Re: REPOST: Relative URLs Can't you embed a ServletContext attribute (variable) in your links using the EL? The attribute value could come from an init param and get set at app startup. Erik tarek.nabil wrote: Hi everyone, I still can not find an answer to my question, so I thought I'd repost this and try to make it clearer. I really apreciate any help. How can I refer to resources that are outside my module in a way that will not mandate rewriting all the URLs in case I change the location of my module in the hierarchy? My URL would look like http://server/my-application/my-module/doSomething.do And inside the JSP I need to refer to an image inside a folder "images", for example, the absolute URL should be http://server/my-application/images/some-image.gif For that purpose, I can not always use the tag, cause some of the images are background images. I thought about the tag, but I can not use the page attribute, cause it's only limited to resources inside the module. I can not use the href attribute, because I do not want to hardcode the application name. I can not use the forward attribute because I do not want to specify a forward for every image. Even for the images that are simple images and I can use the tag, I can not use the pageKey attribute, also because it's module relative and also because then I would need to all the images in the ApplicationResources.properties file. Thanks, Tarek Nabil - 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] -- Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. -- - 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]
RE: REPOST: Relative URLs
Hi David, I'm afraid I don't understand your solution. I'm using Struts 1.1, but I don't know what you mean by contextRelative="false". It doesn't seem to be an attribute on the img or image tags. Also, I need a solution that will work with plain old html tags as well, not just with Struts html tags, since as I mentioned, some of the images are background images and I can not use html:img with that. Could you please explain further. Thanks -Original Message- From: David G. Friedman [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 30, 2005 3:28 AM To: Struts Users Mailing List Subject: RE: REPOST: Relative URLs Dear Tarek, Action example URL: http://server/my-application/my-module/doSomething.do Resulting JSP's image example UR: http://server/my-application/images/some-image.gif What happens when you use html:img with (depending on your version of Struts): a) contextRelative="false"[for 1.1 or earlier] b) module=""[for 1.2 or newer] Then add your src="/images/some-image.gif". That SHOULD keep your module relative to your webapps "/images" directory and NOT CARE what your webapp name is or someday changes into instead of "/my-application" For more details, skim the HTML taglib userGuide at: http://struts.apache.org/userGuide/struts-html.html#image Regards, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: REPOST: Relative URLs
Thanks everyone. I really like the idea of using a ServletContext attribute, but I'm not using the EL, is there a way I can do that without using the EL? -Original Message- From: Benedict, Paul C [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 29, 2005 6:26 PM To: 'Struts Users Mailing List' Subject: RE: REPOST: Relative URLs Erik, The problem may be that you are using JSP Tags, which are commonly written to only output links to resources within your context. You may want to simply think of writing plain old and tags and do it yourself. -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 29, 2005 9:18 AM To: Struts Users Mailing List Subject: Re: REPOST: Relative URLs Can't you embed a ServletContext attribute (variable) in your links using the EL? The attribute value could come from an init param and get set at app startup. Erik tarek.nabil wrote: >Hi everyone, > >I still can not find an answer to my question, so I thought I'd repost >this and try to make it clearer. I really apreciate any help. > > >How can I refer to resources that are outside my module in a way that >will not mandate rewriting all the URLs in case I change the location of >my module in the hierarchy? > >My URL would look like >http://server/my-application/my-module/doSomething.do > >And inside the JSP I need to refer to an image inside a folder "images", >for example, the absolute URL should be > >http://server/my-application/images/some-image.gif > >For that purpose, I can not always use the tag, cause some of >the images are background images. > >I thought about the tag, but > >I can not use the page attribute, cause it's only limited to resources >inside the module. > >I can not use the href attribute, because I do not want to hardcode the >application name. > >I can not use the forward attribute because I do not want to specify a >forward for every image. > >Even for the images that are simple images and I can use the >tag, I can not use the pageKey attribute, also because it's module >relative and also because then I would need to all the images in the >ApplicationResources.properties file. > >Thanks, >Tarek Nabil > >- >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] -- Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: REPOST: Relative URLs
Dear Tarek, Action example URL: http://server/my-application/my-module/doSomething.do Resulting JSP's image example UR: http://server/my-application/images/some-image.gif What happens when you use html:img with (depending on your version of Struts): a) contextRelative="false"[for 1.1 or earlier] b) module=""[for 1.2 or newer] Then add your src="/images/some-image.gif". That SHOULD keep your module relative to your webapps "/images" directory and NOT CARE what your webapp name is or someday changes into instead of "/my-application" For more details, skim the HTML taglib userGuide at: http://struts.apache.org/userGuide/struts-html.html#image Regards, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: REPOST: Relative URLs
Erik, The problem may be that you are using JSP Tags, which are commonly written to only output links to resources within your context. You may want to simply think of writing plain old and tags and do it yourself. -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 29, 2005 9:18 AM To: Struts Users Mailing List Subject: Re: REPOST: Relative URLs Can't you embed a ServletContext attribute (variable) in your links using the EL? The attribute value could come from an init param and get set at app startup. Erik tarek.nabil wrote: >Hi everyone, > >I still can not find an answer to my question, so I thought I'd repost >this and try to make it clearer. I really apreciate any help. > > >How can I refer to resources that are outside my module in a way that >will not mandate rewriting all the URLs in case I change the location of >my module in the hierarchy? > >My URL would look like >http://server/my-application/my-module/doSomething.do > >And inside the JSP I need to refer to an image inside a folder "images", >for example, the absolute URL should be > >http://server/my-application/images/some-image.gif > >For that purpose, I can not always use the tag, cause some of >the images are background images. > >I thought about the tag, but > >I can not use the page attribute, cause it's only limited to resources >inside the module. > >I can not use the href attribute, because I do not want to hardcode the >application name. > >I can not use the forward attribute because I do not want to specify a >forward for every image. > >Even for the images that are simple images and I can use the >tag, I can not use the pageKey attribute, also because it's module >relative and also because then I would need to all the images in the >ApplicationResources.properties file. > >Thanks, >Tarek Nabil > >- >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] -- Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: REPOST: Relative URLs
Can't you embed a ServletContext attribute (variable) in your links using the EL? The attribute value could come from an init param and get set at app startup. Erik tarek.nabil wrote: Hi everyone, I still can not find an answer to my question, so I thought I'd repost this and try to make it clearer. I really apreciate any help. How can I refer to resources that are outside my module in a way that will not mandate rewriting all the URLs in case I change the location of my module in the hierarchy? My URL would look like http://server/my-application/my-module/doSomething.do And inside the JSP I need to refer to an image inside a folder "images", for example, the absolute URL should be http://server/my-application/images/some-image.gif For that purpose, I can not always use the tag, cause some of the images are background images. I thought about the tag, but I can not use the page attribute, cause it's only limited to resources inside the module. I can not use the href attribute, because I do not want to hardcode the application name. I can not use the forward attribute because I do not want to specify a forward for every image. Even for the images that are simple images and I can use the tag, I can not use the pageKey attribute, also because it's module relative and also because then I would need to all the images in the ApplicationResources.properties file. Thanks, Tarek Nabil - 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]
REPOST: Relative URLs
Hi everyone, I still can not find an answer to my question, so I thought I'd repost this and try to make it clearer. I really apreciate any help. How can I refer to resources that are outside my module in a way that will not mandate rewriting all the URLs in case I change the location of my module in the hierarchy? My URL would look like http://server/my-application/my-module/doSomething.do And inside the JSP I need to refer to an image inside a folder "images", for example, the absolute URL should be http://server/my-application/images/some-image.gif For that purpose, I can not always use the tag, cause some of the images are background images. I thought about the tag, but I can not use the page attribute, cause it's only limited to resources inside the module. I can not use the href attribute, because I do not want to hardcode the application name. I can not use the forward attribute because I do not want to specify a forward for every image. Even for the images that are simple images and I can use the tag, I can not use the pageKey attribute, also because it's module relative and also because then I would need to all the images in the ApplicationResources.properties file. Thanks, Tarek Nabil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
REPOST: Relative URLs
Can someone please advise me on this issue. Thanks -Original Message- From: tarek.nabil Sent: Saturday, March 19, 2005 10:14 AM To: user@struts.apache.org Subject: Relative URLs Hi everyone, Can someone please explain how to build relative URLs that are higher in the file hierarchy than the module. For example / /images/some-image.gif /some-action.do /folder/some-jsp.jsp I'm building this application inside an existing application that does not use Struts. I can not change the location of images or stylesheet and I can not duplicate them. I get the HTMLs from the graphic designer with the stylesheets and images as relative URLs, e.g. ../images/some-image.gif. I thought that for the images, I can solve it with the html:img tag, but then I discovered that I have some td tags with an image background. I thought about URL re-writing, and then I found out I only have two options: 1- Specify a forward for every image which is time consuming and tedious. 2- Use the page attribute, which means that the module has to be on the same level as the images, because the documentation states that the page attribute has to start with a "/". In my application, I go to the JSP directly and then through an action. Since they're both on different levels, when I go through the action, the images disappear. I thought about going to the JSP through an action all the time, but I then I thought I could still face a problem if I ever decide to switch to multiple modules. For example, in the above setup, I would use the page attribute and write page=3D"/images/some-image.gif". But then if I ever decide to use multiple modules and moved my action to /some-module/some-action.do I will not be able to change the page attribute because I can NOT say (as far as I understand) page=3D"../images/some-image.gif". Can someone please help me with this problem. Thanks, Tarek - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Relative URLs
Hi everyone, Can someone please explain how to build relative URLs that are higher in the file hierarchy than the module. For example / /images/some-image.gif /some-action.do /folder/some-jsp.jsp I'm building this application inside an existing application that does not use Struts. I can not change the location of images or stylesheet and I can not duplicate them. I get the HTMLs from the graphic designer with the stylesheets and images as relative URLs, e.g. ../images/some-image.gif. I thought that for the images, I can solve it with the html:img tag, but then I discovered that I have some td tags with an image background. I thought about URL re-writing, and then I found out I only have two options: 1- Specify a forward for every image which is time consuming and tedious. 2- Use the page attribute, which means that the module has to be on the same level as the images, because the documentation states that the page attribute has to start with a "/". In my application, I go to the JSP directly and then through an action. Since they're both on different levels, when I go through the action, the images disappear. I thought about going to the JSP through an action all the time, but I then I thought I could still face a problem if I ever decide to switch to multiple modules. For example, in the above setup, I would use the page attribute and write page=3D"/images/some-image.gif". But then if I ever decide to use multiple modules and moved my action to /some-module/some-action.do I will not be able to change the page attribute because I can NOT say (as far as I understand) page=3D"../images/some-image.gif". Can someone please help me with this problem. Thanks, Tarek - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
html:form action and relative URLs addressed in 1.2 ?
Hello, I have been building a fairly large Java webapp for 3 years now, and it was originally using Struts 1.0. Due to search engine optimization, we ended up doing lots or URL manipulation via mod_rewrite. But then the problem was that when the user submitted the struts form, it would lose the URL. i.e. if the url was: http://www.usachurch.com/arizona/phoenix/churches.jsp (the directories /arizona and /phoenix are not real, but mod_rewrite passes the values to the jsp page.) and the struts form was: It would end up at: http://www.usachurch.com/searchresults.jspinstead of http://www.usachurch.com/arizona/phoenix/searchresults.jsp So, we looked around and found a Struts 1.1 source customization called "IsRelative". (submitted by Erik Tennant as Bugzilla bug #17449) We compiled it (after many,many tries) and it worked - such as: which then kept the URL intact. My question is whether Struts 1.2 or later has some kind of built in functionality like this now? I'd like to be able to upgrade to later versions of Struts over the years, and not have to go through all of the hassle of customizing the source code each time. Regards, Devin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts forms and relative URLs fixed in 1.2 ?
Hello, I have been building a fairly large Java webapp for 3 years now, and it was originally using Struts 1.0. Due to search engine optimization, we ended up doing lots or URL manipulation via mod_rewrite. But then the problem was that when the user submitted the struts form, it would lose the URL. i.e. if the url was: http://www.usachurch.com/arizona/phoenix/churches.jsp (the directories /arizona and /phoenix are not real, but mod_rewrite passes the values to the jsp page.) and the struts form was: It would end up at: http://www.usachurch.com/searchresults.jspinstead of http://www.usachurch.com/arizona/phoenix/searchresults.jsp So, we looked around and found a Struts 1.1 source customization called "IsRelative". We compiled it (after many,many tries) and it worked - such as: which then kept the URL intact. My question is whether Struts 1.2 or later has some kind of built in functionality like this now? I'd like to be able to upgrade to later versions of Struts over the years, and not have to go through all of the hassle of customizing the source code each time. Regards, Devin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]