What are the possible ways to convert below Struts 1 code to migrate in Struts 2. I know <s:select>
tag but how to integrate <c:foreach>
JSTL in that?
<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, that is enough. Struts2 can use JSTL so, you can cut your time on migration.
<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, that this code supposed to use for migration purposes. If you are developing a new application you can spend more time to redesign your code with struts tags (if you really need them).