我有这么个事情要做:
原来的系统中有很多jsp:include,例如:
<jsp:include page="/a/b/c.jsp" >
<jsp:param name="paramxx1" value="yy1"/>
<jsp:param name="paramxxx" value="yyy"/>
</jsp:include>
参数名称和个数不定。
现在要把这个include行为修改一下,先找/a/b/c.jsp, 如果找不到,就找 newfolder/a/b/c.jsp
我想用JSP自定义tag来做,现在卡在参数传递这了。
我是做后台开发的,jsp tag的资料不是很熟。
现在我写的tag文件如下
`<%@ tag
body-content="scriptless"
dynamic-attributes="dynParameters"
import="java.net.URL" %>
<%@ attribute name="page" type="java.lang.String" required="true" %>
<%! public URL fileURL;%>
<%
String filePath = (String)pageContext.getAttribute("page"); //should be replaced with some mechanism of getting the name;perhaps as a request attribute
fileURL = pageContext.getServletContext().getResource(filePath);
%>
<% if(fileURL==null) {
// cannot found orignal file
filePath = "newFolder/" + filePath;
} else {
// already prevent jsp files
} %>
/jsp:include
然后使用的地方改成
该怎么处理jsp:param的动态参数传递呢?