0

I am using Struts1.1 in a web application. My requirement is to trim leading and trailing spaces from the request parameters of each request. We are fetching request parameters through Struts form instead of fetching it through request.

Trimming spaces from each request parameter at the time of fetching it is not at all good approach. Since filter is not used in my application, I am thinking of any other option to do this?

What approach can I follow to do this?

4

1 回答 1

0
  1. 使用过滤器。
  2. 实现自定义请求处理器。

哪种方法取决于项目中已有的其他内容;如果你已经有一个自定义请求处理器,我可能会在那里做而不是引入一个新的过滤器。如果您不这样做,那么过滤器非常容易,并且可以在您升级旧版本的 Struts 时使用。

于 2013-06-27T12:03:04.680 回答