Senhores, tenho que fazer um controle de layout usando includes.
Estou fazendo assim:
<%if (session.getAttribute("origemLogon").equals("1")) {%>
<%@include file='file1.jsp' %>
<%} else if(session.getAttribute("origemLogon").equals("2")){%>
<%@include file='file2.jsp' %>
<%} %>
como não tem como fazer o seguinte controle:
<%@include file='file${origemLogon}.jsp' %>
estava pensando em fazer uma taglibrary onde é montada um include na tela. Assim:
public class IncludeMenu extends TagSupport{
private static final long serialVersionUID = 1L;
public int doStartTag() throws JspException {
try {
String codParceiro = pageContext.getRequest().getParameter("origemLogon");
JspWriter out = pageContext.getOut();
out.println("<%@include file='file.jsp' %>");
return SKIP_BODY;
} catch (Exception e) {
throw new JspException(e);
}
}
}
mas em vez de mostrar o conteúdo do include ele mostra na tela a tag include pelo fato de eu estar usando o JspWriter.
Existe alguma forma de inserir um include sem o JspWriter???