Thursday, 15 March 2012

jsp - Dropdown struts 2 -



jsp - Dropdown struts 2 -

what possible ways convert below struts 1 code migrate in struts 2. know s:select tag how integrate c:foreach jstl in that?

class="lang-xml prettyprint-override"><html:select property="acti" onchange="setacti(form);" style="width:45px"> <html:option value=""><s:text name="form.date" /></html:option> <c:foreach items="${v}" var="var"> <c:if test="${not (var eq form.acti)}"> <option value="<c:out value="${var}"/>"><c:out value="${var}"/></option> </c:if> <c:if test="${var eq form.acti}"> <option selected value="<c:out value="${form.jacti}"/>"><c:out value="${form.acti}"/></option> </c:if> </c:foreach> </html:select>

you should remove struts1 tags, enough. struts2 can utilize jstl so, can cutting time on migration.

class="lang-jsp prettyprint-override"><select name="activite" value="<c:out value='${form.activite}'/>" onchange="setactivite(form);" style="width:45px"> <option value=""><s:text name="form.date.jour" /></option> <c:foreach items="${jour}" var="varjour"> <c:if test="${not (varjour eq form.activite)}"> <option value="<c:out value="${varjour}"/>"><c:out value="${varjour}"/></option> </c:if> <c:if test="${varjour eq form.activite}"> <option selected value="<c:out value="${form.jactivite}"/>"><c:out value="${form.activite}"/></option> </c:if> </c:foreach> </select>

note, code supposed utilize migration purposes. if developing new application can spend more time redesign code struts tags (if need them).

jsp struts2 jstl struts el

No comments:

Post a Comment