%! String str = "prerna"; % jsp:include page="index.html" jsp:param name="type1" value=%=str% /jsp:param /jsp:include 我想在param标签中传递一个java变量,但我不知道该怎么做。 我也想在index.html中访问它。 有人可
          <%!  
    String str = "prerna";  
  %>  
 <jsp:include page="index.html">
      <jsp:param name="type1" value=<%=str%> >
      </jsp:param>  
 </jsp:include> 
 我想在param标签中传递一个java变量,但我不知道该怎么做。
我也想在index.html中访问它。
有人可以建议我这样做吗?
<jsp:include page="index.html">
    <jsp:param name="type1" value="prerna" />
</jsp:include> 
 或使用JSTL< c:set>设置它和EL $ {}来获得它。
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
...
<c:set var="type1" value="prerna" />
...
<jsp:include page="index.html">
    <jsp:param name="type1" value="${type1}" />
</jsp:include> 
 如果您的附件页面是jsp,那么可以使用$ {param.type1}
