Is it possible to have a dynamic path as part of a

2019-05-27 04:44发布

I have a include file in my jsp

    <%@ include file = "includes/testinclude1.jsp" %>

Test Include1 contains struts tags, and therefore needs to be pulled in and compiled. Which works ok. Is there a way to make the path for this file be dynamic in any way or am I looking at a rethink in terms of design?

3条回答
干净又极端
2楼-- · 2019-05-27 05:04

For anyone that is curious, I used a struts include tag, based on artbristols answer and managed to make it dynamic with OGNL. Thanks for all your input.

<s:include value="includes/templates/%{post.template.name}.jsp" />
查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-05-27 05:04

yes

<%
    String usuarioTipo = uDTO.getNombreGrupo().toLowerCase();
    String menu = "../WEB-INF/../jspf/".concat(usuarioTipo).concat("/menu.jspf");
%>
<jsp:include page ="<%=menu%>"/>
查看更多
爱情/是我丢掉的垃圾
4楼-- · 2019-05-27 05:26

You can the <jsp:include page="..."> tag instead of the static <%@ include %> which only works for static references.

查看更多
登录 后发表回答