gigaZhang / struts2-jquery

Automatically exported from code.google.com/p/struts2-jquery
0 stars 0 forks source link

sj:select multiple=true value="%{objectList}" array of default value not present #1023

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
(This is for feature requests and bugs in Struts2 jQuery Plugin - for
getting help, please use the User Group.
http://groups.google.com/group/struts2-jquery )

What steps will reproduce the problem?
1.set ArrayList<String> in action
2. define multiple="true", value="%{objectList}" in sj:select
3. array of string value not present, if define single string, be fine.

What is the expected output? What do you see instead?

Which struts2 version? 2.3.7

Which struts2-jquery plugin version? struts2-jquery-plugin-3.5.1.jar

Please provide any additional information below.

Result:

    Keyword Type Display
            "Poles" 
    Keyword display
            None

Expection

    Keyword should display multiple value, which is predefined as 'One Pole','Three Pole' before return from action.

    define single String never be problem, but problem happen when defined as ArrayList<String> for multiple select (pre select)    

JSP file
                    <label for="language_pattern01">Keyword Type: </label>
                                <s:url id="remoteurl_pattern01" action="KeywordpatterntypeAction"/>
                                <sj:select 
                                        href="%{remoteurl_pattern01}" 
                                        id="language_pattern01" 
                                        onChangeTopics="reloadsecondlist_pattern01" 
                                        name="language_pattern01" 
                                        list="languageObjList_pattern01" 
                                        listKey="myKey" 
                                        listValue="myValue" 
                                        emptyOption="true" 
                                        headerKey="-1" 
                                        headerValue="Select Type"
                                        resizableMinHeight="10"
                                        value="%{patternKeywordType1}"
                                        />                                />
                </div><br>
                <div class="type-text">
                    <label for="echo_pattern01">Multiple Keyword: </label>
                                <s:url id="remoteurl_pattern01" action="KeywordpatterntypeAction"/>
                                <sj:select 
                                        href="%{remoteurl_pattern01}" 
                                        id="selectWithReloadTopic_pattern01" 
                                        formIds="formEditReload" 
                                        reloadTopics="reloadsecondlist_pattern01" 
                                        name="echo_pattern01" 
                                        list="reloadList_pattern01" 
                                        multiple="true"
                                        selectable="true"
                                        emptyOption="true" 
                                        headerKey="-1" 
                                        headerValue="Select keywords"
                                        resizableMinHeight="15"
                                        resizableMaxHeight="20"
                                        cssClass="multiselect" dataType="json"
                                        value="%{patternKeyword1}"
                                />
                </div>

Action java

public class KeywordprepareeditAction extends BaseKeywordprocessManagerAction {

  private String patternKeywordType1;
  private ArrayList<String> patternKeyword1;

  public String getPatternKeywordType1() { return patternKeywordType1; }
  public ArrayList<String> getPatternKeyword1() { return patternKeyword1; }
  public void setPatternKeywordType1(String patternKeywordType1) { this.patternKeywordType1=patternKeywordType1;}
  public void setPatternKeyword1(ArrayList<String> patternKeyword1) { this.patternKeyword1=patternKeyword1;}

  public String execute() throws Exception {

         patternKeywordType1="Poles";
         patternKeyword1=new ArrayList<String>();
         patternKeyword1.add("One Pole");
         patternKeyword1.add("Three Pole");

        //logger.info("Keywordcategory start\n");

        preSelectedVal="Motor";
        preSubCateVal="Blower";

        return "success";
}

public String getJSON()  throws Exception
  {
    return execute();
  }

}

Original issue reported on code.google.com by jiong.se...@gmail.com on 8 Aug 2013 at 8:14

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by johgep on 9 Aug 2013 at 8:16