在 jsp 之間傳遞變數, 可以這樣做:
<%!
String str = "prerna";
%>
<jsp:include page="index.html">
<jsp:param name="type1" value="<%=str%>" />
</jsp:include>
或:
Using request.setAttribute()
you can pass the Java variable to the JSP.
<%
String str = "prerna";
request.setAttribute("myVar",str);
%>
<jsp:include page="index.html">
<jsp:param name="type1" value="${myVar}" >
</jsp:param>
</jsp:include>
資料來源:
https://stackoverflow.com/questions/5444083/pass-java-variable-in-jspparam