J T wrote:
We have four environments: dev, int, stg, and prod. Each of these is fronted
by an apache server
that proxies to our weblogic application server.

The URLs to the apps look like this
(dev) http://devserver.com/dev/Application
(int) http://intserver.com/int/Application
(stg) http://stgserver.com/stg/Application
(prod) http://prodserver.com/Application (no directory)


Two of my actions look like this
<action
   path="/viewMain"
   parameter=".Main"
   name="myForm"
   validate="false"
   type="org.apache.struts.actions.ForwardAction"
   scope="session">
</action>

<action
   path="/processMain"
   name="myForm"
   input=".Main"
   type="com.company.action.ProcessFormAction"
   scope="session"
   validate="true">
    <forward name="success" path="/viewNew.do"/>
</action>


When my jsp is rendered in the dev environment it looks like this…

...
<head>
    <base href="http://devserver.com/Application/jsp/mainLayout.jsp";>

...
</head>

...
<form name="myForm" method="POST" action="/Application/processMain.do">
    <input type="text" name="mynbr" value="">
    <input type="submit" value="Submit">
</form>

...

So when I click submit the POST goes to http://devserver.com/Application/
and not http://devserver.com/dev/Application

I don't want to hard code my struts-config since this needs be
deployed to 4 places.

I have read through the mailing list archives and the only viable
solution that I have seen is to create a base action that strips the
leading slash off of the forwards so that the POST goes back to
the right place.

Is there a better way of doing this?

See:

http://struts.apache.org/struts-doc-1.2.x/userGuide/struts-html.html#base
html:base tag, will set up your <base> element for you so you can use relative URLs

http://struts.apache.org/struts-doc-1.2.x/userGuide/struts-html.html#link
html:link tag, helps construct URLs without having to know the deployment context path, etc.

Between the two, you should be able to make your application independent of the path under which you deploy it.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to