A dúvida é a seguinte.
Dentro do arquivo *.tag se eu usasse expression language como no id “${id}”, eu conseguiria pegar os dados dos atributos
Mas e para pegar os dados a partir de um bloco de scriptlet.
Pego do request … application ???
<%@tag import="java.util.*"%>
<%@tag description="option list" pageEncoding="UTF-8"%>
<%-- The list of normal or fragment attributes can be specified here: --%>
<%@attribute name="id" required="true"%>
<%@attribute name="name" required="true"%>
<%@attribute name="class" required="false"%>
<%@attribute name="label" required="true"%>
<%@attribute name="itemList" required="true"%>
<%@attribute name="item" required="true"%>
<%-- any content can be specified here e.g.: --%>
<label for="${id}">${label}</label>
<select name="${name}" id="${id}" class="${class}">
<%
String entrada_nomes = (String) application.getAttribute("itemList");//???????????????????????????????????????????????????????????????
List<String> nomes = new ArrayList<String>();
String saida = "";
for (int i = 0; i < entrada_nomes.length(); i++) {
char c = entrada_nomes.charAt(i);
if (c != ',') {
saida += c;
} else {
nomes.add(saida);
saida = "";
}
}
nomes.add(saida);
String propriedade = (String) application.getAttribute("item");//????????????????????????????????????????????????????????????????
if (propriedade != null && !propriedade.equals("")) {
for (int i = 0; i < nomes.size(); i++) {
if (!propriedade.equals(nomes.get(i))) {
%>
<option value="<%= nomes.get(i)%>"><%= nomes.get(i)%></option>
<%
} else {
%>
<option value="<%= propriedade %>" selected><%= propriedade %></option>
<%
}
}
} else {
for (int i = 0; i < nomes.size(); i++) {
%>
<option value="<%= nomes.get(i) %>"><%= nomes.get(i) %></option>
<%
}
}
%>
</select>
Ou isso não é possível ?