• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Context root and html paths

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello i'm new of struts and i have a strange problem, i hope you can help me.

I have an EAR application with this context:

http://mydomain/myear/

In a weblogic server. I installed inside two indipendent WAR application

war1 with "app1" context root (set in application.xml)
war2 with "app2" context root.

I have to sat that i can not modify any weblogic configuration, i have a single server in that domain with a fixed root (mydomain/myear)
The application server answer correctly here:


http://mydomain/myear/app1 -> to the war1
http://mydomain/myear/app2 -> to the war2

My trouble is when struts and his tiles create the html path in the views, becuse it thinks that the root is "app1" and not "myear/app1".
Infact the homepage correctly started but inside the html:form tag had this action path: "/app1/MyAction" and obviously it will send to http://mydomain/app1/MyAction out of my application.
How can i setup struts to add "myear/" before the context root when it makes the html paths?

Thank you.



 
Ranch Hand
Posts: 479
1
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

You can use a request.getContextPath() along with the URL. But my understanding is that if you use html:xxx tags Struts takes care of adding the context path by default? Check out this post

Javaranch forum link

Cheers,
Raj.
 
Tobia Scapin
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your answer.
It can be, but i must change every page... I hope there is some configuration... or no?

This is a big application that before was deployed in a domaim root (http://mydomain/app1) so everything worked correctly... but now it moves to a sub-folder of the domain, that it is still in a virtualserver root (server side the context root is corret), but i need to map the path action in html with the context-root (already done by struts) "app1" but prepending "myear", exists some configuration attribute?

Thanks
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See the JSP FAQ for more information on this. And yes, you need to fix the URLs -- there's no config to do so. How could there be?
 
Tobia Scapin
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe it did not well explain...
I use this tag: <html:form action="/MyAction"> and /MyAction refer to an action in the struts config.
In generated html this became: <form action="/app1/MyAction" > so struts automatically (correctly) prepend to action the context-root of my app.
There is no way to use a relativePath or to manually set the context-path (/myear/app1 instead of /app1)?

 
What are you doing? You are supposed to be reading this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic