Struts 2 : Passing array of String as static param

前端 未结 5 486
生来不讨喜
生来不讨喜 2020-12-21 07:11

I wanted to declare an action in such a way that I could pass String array of static parameter. I tried the below code:



        
5条回答
  •  北荒
    北荒 (楼主)
    2020-12-21 07:33

    AFAIK static parameters are converted to String, that why various interceptors (e.g. FileUploadInterceptor) use static method commaDelimitedStringToSet of TextParseUtil to convert String to Set. You can call this method inside setter for your property.

    public void setNames(String name) {
        mNames = TextParseUtil.commaDelimitedStringToSet(name);
    }
    

提交回复
热议问题