s:表单标签操作参数被删除 [英] s:form tag action parameters being removed

查看:185
本文介绍了s:表单标签操作参数被删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经搜查和搜查,这正在毁灭我。我有这个:

 < s:form method =postaction =%{methodOne}cssClass =buttons > 

emailFormUrl正确返回URL,但参数已被删除。

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

这就是说:

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

由于某些原因,id被剥离了,这使我得到了一个验证错误,并没有完成我所需要的操作。据我所知,我们在七月份的紧急安全更新之前没有问题,但它是很少使用的小功能(我想它的移除是一个争论)。



我不想添加隐藏参数,因为我想了解这不起作用的原因,而不是解决方法(我仍然处于繁重的学习部分)在$ servlet环境中,< s:form> $ c>标记使用 ServletUrlRenderer 类来呈现表单url。
如果找不到 action 属性中指定的动作配置,那么动作的文字值(w / o参数) c $ c>属性将被使用。



注意:您需要使用操作名称w / o扩展名才能找到在配置中。因此,如果在配置中有 some_action ,但是<$ c $> some_action?foo = bar 将以参数形式设置$ c> some_action.action?foo = bar 不会被找到,因为 .action 扩展名和参数将被删除。


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).

解决方案

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.

这篇关于s:表单标签操作参数被删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆