pass java variable in jsp:param

在 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

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *