Uploaded image for project: 'Click'
  1. Click
  2. CLK-334

Form action incorrect when using JSP

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.4, 1.4-RC3
    • 1.5 M1, 1.4.1
    • core
    • None
    • java 1.6, Resin 3.0.23

    Description

      I'm using JSP for pages with a template JSP used for all pages. The click framework will forward to the template JSP which will in turn include the page's JSP. If I put a Form on my page, the form's action value comes from the getActionURL which determines the value to use based on the value of getRequestURI(). However, because the original template JSP has been forwarded to, the value at this point is of the template, not the page. At least this is the case in the Resin environment in which I'm working. To get my pages to work, I modified the Form's getActionURL as show below, based on the information here: http://www.caucho.com/resin-3.0/webapp/faq.xtp#forward

      Here's my mod to Form that solves my problem:

      /**

      • Return the form "action" attribute URL value. The action URL will be
      • encode by the response to ensure it includes the Session ID if required.
        *
      • @return the form "action" attribute URL value.
        */
        public String getActionURL()
        Unknown macro: { HttpServletRequest request = getContext().getRequest(); HttpServletResponse response = getContext().getResponse(); String requestURI = (String)request.getAttribute("javax.servlet.forward.request_uri"); if ((requestURI == null) || (requestURI.length()==0)) { requestURI = request.getRequestURI(); } return response.encodeURL(requestURI); }

      Attachments

        Activity

          People

            sabob Bob Schellink
            chas Chas Honton
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: