Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-2862

s:form generates wrong action url - ".action" suffix is missing

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.11.2
    • 2.1.3
    • None
    • Pluto 1.1.6, JDK 1.5, Tomcat 6.0.13

    Description

      Hi.
      I am using Struts2 in a portlet / servlet environment.
      Using portlets s:form behaves well.
      But if i use actions through the FilterDispatcher, the url generated is wrong:

      It should look like:

      <form action="abc.action">
      ...
      </form>

      but using <s:form action="acb" namespace="rules"> ... it generates:

      <form action="abc">

      Where

      and this is a non functional form as there is no url names abc, but abc.action. The rules namespace is child of the root view namespace. (/view/rules/index.action is the url which generates the form and to which the post should go back).

      Interesting notes about action config stuff:

      Using the initial "request" when calling the url namespace is "/view/rules" and action="index" - getActionConfig in DefaultConfiguration XWork class does find an action config.
      When the form is rendered the namespace only reads "rules" instead of "/view/rules" and i get this warning:

      15:48:28,520 WARN [org.apache.struts2.components.Form] No configuration found for the specified action: 'index' in namespace: 'rules'. Form action defaulting to 'action' attribute's literal value.

      I am using it primarily for portlets and my default namespace is /view - this does work fine in s:form tags requested through portletDispachter - using the same with FilterDispatcher won't work, because the /view is missing.
      This is inconsistent because it won't allow me to use a page from portlet and servlets.
      Any ideas how to solve this? Is there a way to tell the FilterDispatcher he should "prepend" the "/view"?

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            tkrah Torsten Krah
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment