URGENT:struts and proxy


Web tier: servlets, JSP, Web frameworks: URGENT:struts and proxy

  1. URGENT:struts and proxy (3 messages)


    I dont know if anyone faces this problem using proxies.

    My application web-context is set as appName. So all requests have
    to go as http://domainname.com/someproxyname/appName/login.do

    This brings up the login page. However the form element has entry as follows:

    <form action="/Login.do" method="POST">

    I hope u see the problem...when i submit the page..the request goes to
    http://domainname.com/appName/login.do...which is incorrect and i get a file not found error.
    So whats the solution to this? how to make the action go to the right place?


    Threaded Messages (3)

  2. URGENT:struts and proxy[ Go to top ]

    I'm sorry to say, but I'm a bit confused about what you're asking...so I'm going to give it my best.

    I will assume your Action classes extends Action (and not DispatchAction or any other variants).

    The perform method will return an ActionForward. This forward is then looked for inside your action mapping. For example, your action mapping would probably look something like this:


    This means that if loginAction returns an ActionForward called welcome then your page will go to welcome.jsp . Please note that it doesn't just have to be a jsp, you can also send it to another class.

    So, in a quick summary: Check your forwards.
  3. URGENT:struts and proxy[ Go to top ]

    I guessed u missed the word "PROXY" in my post. The app works fine without deploying to the production server that uses a proxy.
    What this means is as follows:

    Normal request to login page without proxy...works fine:

    When request is thru proxy, the initial or first request is made as:

    This does give the login page ...but the form tag in the login page is:
    <form action="/Welcome.do" method="POST">

    Now when this form is submitted..the request goes to http://proxyname.com/appName/Welcome.do instead of http://proxyname.com/proxyname/appName/Welcome.do

    Do u see the problem in this now?...so what shud i do either in the form element
    or the action mapping that would detect this proxy URL and send the request to

    thanks a lot!
  4. URGENT:struts and proxy[ Go to top ]

    In your JSP why don't you try to use the <html:base /> tag? That way the form will look for /Welcome.do in the same folder that is currently in the URI.

    html:base documentation: http://struts.apache.org/userGuide/struts-html.html#base

    Give it a try, tell me how it goes.