• 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

Not include webapp context path

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a problem with a site on struts2.
First I developed the site on http://localhost:8080/site
Then QA team deployed it to http://testmachine/site - all worked ok.
Then QA created http://sub.anotherdomain.com that pointed to http://testmachine/site - and that is where problems began.
I notice that all links was like http://sub.anotherdomain.com/site/some.action - it means that the real path link was pointing to was http://testmachine/site/site/some.action which was wrong.
The struts tag included the webapp context path (/site) which was the place the site actually deployed.

I found the way to work only on http://sub.anotherdomain.com/ or on http://testmachine/ (root context) with same way. I changed the includeContext="false" on all s:url tags. But that is not working with s:form that is still includes context information in action="sendMail.action".

1. How to have my site working both on http://testmachine/site and http://sub.anotherdomain.com/ >pointed to>http://testmachine/site
or
2. How to have <s:form action="sendMail.action" method="get" theme="simple"> pointed to http://sub.anotherdomain.com/sendMail.action but not on http://sub.anotherdomain.com/site/sendMail.action ??
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The form tag will include the application context, whether it's an empty string or an actual context--I'm not sure what problem you're actually having. Maybe the problem is that you're including the ".action" in the form tag, which is neither necessary, nor a good idea.
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello again David - I believe I'm having the same problem that Mike Nason did.

Briefly stated, I'm trying to use a Struts2 form tag in an application which is deployed in an app in a WebLogic container, which is "front-ended" by a high-performance web server.

The server drives mapped URL requests back to my app using some re-writing rules -- so even though I've deployed my app with the context of MyApp, it brokers requests to a "jsp" folder at the root of the domain back to the application for handling.

The problem comes in when I use the <s:form> tag to set up a form pointing back to an action. I need the output of:



to be:



Instead of:



I see how having the Struts2 <s:form /> tag automatically prepend the context path would be useful, but like Mike Nason, I'm trying to find a way to prevent it. Is there an attribute in the tag that I'm misunderstanding, or a struts.xml value I need to enable?

Peter DiCrescenzo
peter.dicrescenzo@gartner.com
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic