File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Struts - how to prepend to the URL? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts - how to prepend to the URL?" Watch "Struts - how to prepend to the URL?" New topic
Author

Struts - how to prepend to the URL?

Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

I developed my struts app on BEA where I had a URL like this: http://host.com:7001/myApp/index.do
In our production environment, we're using an Apache front end, so the BEA stuff has been aliased to something like this: http://host.com/BEA/myApp/index.do

Going to that first page works fine, but when I click on a link the "/BEA" gets cut out of the URL and it goes to: http://host.com/myApp/page2.do

In all my pages I use a link like this: <html:link action="/page2" >asdf</html:link>

Originally I thought that using the "forwardPattern" in my struts-config <controller> was the right way to fix this, but its not working yet...

any ideas?


- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Try:

web.xml

<init-param>
<param-name>config/BEA</param-name>
<param-value>WEB-INF/struts-config.xml</param-value>
</init-param>


A good workman is known by his tools.
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4991
    
    8

Originally posted by Marc Peabody:
Try:

web.xml

<init-param>
<param-name>config/BEA</param-name>
<param-value>WEB-INF/struts-config.xml</param-value>
</init-param>


Marc, could you explain how this would help? I'm not grokking it. My first thought was that the problem had something to do with the aliasing of BEA in Apache. I seem to recall encountering a similar problem with Apache and Oracle 9iAS in my last project although I have no idea how that was resolved.


Junilu - [How to Ask Questions] [How to Answer Questions]
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

So, the problem isn't something that can or should be addressed in struts

(I posted the same question on the struts-user list and got a reply from Craig McClanahan that put me on the right path)

(Posted by me on the struts user list)

Basically how our apache-BEA bridge worked before was that if Apache saw /BEA at the beginning of the URL, it stripped /BEA from the URL and sent the request to BEA to be serviced. BEA saw the /myApp context and handled the app as per normal. But then when it came time to generate a link, it simply used the context root, having no idea bout the /BEA thing...

SO -- we modified the apache-BEA link to NOT strip out the /BEA from the URL (by commenting out the PathTrim in the httpd.conf), and then adjusted the context-root of the webapp to be /BEA/myApp (using the <context-root> element in the weblogic.xml) and now everything is hunky-dory.

[ July 16, 2004: Message edited by: Jessica Sant ]
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4991
    
    8

Originally posted by Jessica Sant:
So, the problem isn't something that can or should be addressed in struts...

SO -- we modified the apache-BEA link to NOT strip out the /BEA from the URL (by commenting out the PathTrim in the httpd.conf), and then adjusted the context-root of the webapp to be /BEA/myApp (using the <context-root> element in the weblogic.xml) and now everything is hunky-dory.


And you didn't even have to call up your legal department...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts - how to prepend to the URL?