Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

s:form tag action parameters being removed

I have searched and searched and this is destroying me. I have this:

<s:form method="post" action="%{methodOne}" cssClass="buttons">

The emailFormUrl returns the URL correctly but the parameters have been stripped.

  public String methodOne() {
    return anotherClass.methodTwo(id);
  }

Which speaks of:

  public static String methodTwo(
      String id) {
    return fastEncode("", "longurl/view.jsp",
        new ParameterPairing("id", id));
  }

For some reason, the id is being stripped, this leaves me with a validation error and doesn't complete the action that I require. As I am aware we did not have a problem with it before the July urgent security update but it is small functionality that is rarely used (an argument for its removal I guess).

I don't want to add a hidden parameter as I want to understand the reason that this is not working, not a workaround (I am still in the heavy learning part of my career).

like image 560
Phish Avatar asked Jan 31 '14 11:01

Phish


1 Answers

In servlet environment the <s:form> tag uses ServletUrlRenderer class to render form url. If configuration for the action specified in action attribute cannot be found then literal value (w/o parameters) of an action attribute will be used.

Note: you need to use action name w/o extension in order that it can be found in configuration. So some_action?foo=bar will be set with parameters in form if you have some_action in configuration, but some_action.action?foo=bar won't be found because of .action extension and parameters will be stripped.

like image 90
Aleksandr M Avatar answered Nov 02 '22 16:11

Aleksandr M