I need to add this to two or more JSP pages. I want to try to avoid boilerplate code and need this code snippet in several JSP pages.
- where do I place this code snippet as far as a directory com.lizardking.demographic.xxx?
- how would I get it to be placed in the JSP file coming from another external file?
- what would this file be considered as far as naming convention, for example, a utility class, etc.
I'm using Spring Boot for the backend.
<%
ArrayList<String> maritalStatusList = new ArrayList<String>();
maritalStatusList.add("single/soltero");
maritalStatusList.add("married/casado");
maritalStatusList.add("divorced/divorciado");
maritalStatusList.add("widow(er)/viudo(a)");
request.setAttribute("maritalStatusList", maritalStatusList);
%>
Marital status/Estado civil
<select id="maritalStatus" name="maritalStatus">
<option value=""></option>
<c:forEach items="${maritalStatusList}" var="listItem">
<option value="${listItem}" <c:if test="${listItem eq demoEntity.maritalStatus}">selected="selected"</c:if> >
${listItem}
</option>
</c:forEach>
</select>