我正在尝试使用以下代码动态包含一个 jsp 文件:
<%@include file="menus/top/${user.roleId}.jsp" %>
在这里,变量user.roleId是int在我的 struts2 操作中设置的。我可以使用以下内容显示它:
<s:property value="user.roleId" />
我希望根据当前登录用户的 roleId 动态包含文件等menus/top/1.jsp。menus/top/2.jsp但是我收到了包含标签的以下异常:
Exception Name: org.apache.jasper.JasperException: File "menus/top/${user.roleId}.jsp" not found
我究竟做错了什么?