0

ShowAction javaクラスがあります。クラスが成功すると、JSPページが表示され、そのjspページには次のものが含まれます。

<bean:define id="stateTypes" name="sessionData" property="stateTypes"  />
<html:select property="issueStateCode" styleClass="smallDropInput" tabindex="5" styleId="myId">
    <html:options collection="stateTypes" property="value" labelProperty="label" />
</html:select>

私のShowActionJavaクラスでは、<html:select>(JSP)の値を次のように設定しています。

sessionData.setStateTypes(TypeHelper.getTypeList(TypeHelper.TYPE_JURISDICTION,
            sessionData.getCarrierId(), sessionData.getProductId()));

<html:select>JSPが表示されるときに選択または自動入力されるリストから特定の値を設定したいと思います。

4

2 に答える 2

1

自動選択されるオプションは、タグの属性がであるgetIssueStateCode()ため、フォームBeanのメソッドによって返される値と同じ値を持つオプションです。property<html:select>issueStateCode

于 2012-11-23T06:59:33.620 に答える
1

解決策を得た。 sessionData.getSession().setAttribute("issueBranch","SetValue"); //to set value that you wants to setそして、JSPでこの値を取得します

<% String issueBranch= request.getSession().getAttribute("issueBranch").toString(); %>

    <html:hidden styleId="myText" property="issueBranch" value='<%=issueBranch %>' /> 

JSで値を設定しますvar val=document.getElementById('myText').value; document.getElementById('myId').value=val; // myId is styleId or id attribute for <html:select>

于 2012-11-26T13:01:32.980 に答える