基本的小常識,但每次都會忘記~~~ :oops:
[color=red]<%include file="a.jsp"%>[/color]
是在編譯時加入,所謂靜態,就是在編譯的時候將a.jsp的代碼加入進來在編譯,之後運行.
[color=red]<jsp:include page="a.jsp"/>[/color]
是在運行時加入,所謂動態,就是單獨編譯,在運行時候加入進來,之後顯示,這種include,可以傳遞參數.
[color=red]<bean:include id="includedPage" page="a.jsp" />
<bean:write name="includedPage" filter="false" />[/color]
和jsp:include差不多,但印象中有不可取代的地方,不過忘了.....
想起來了:
[color=red]<bean:include id="includedPage" page="test.do/method=aa" />
<bean:write name="includedPage" filter="false" />[/color]
如果一定得用struts的forward方式來include,那就得這樣用了!!
[color=red]<%include file="a.jsp"%>[/color]
是在編譯時加入,所謂靜態,就是在編譯的時候將a.jsp的代碼加入進來在編譯,之後運行.
[color=red]<jsp:include page="a.jsp"/>[/color]
是在運行時加入,所謂動態,就是單獨編譯,在運行時候加入進來,之後顯示,這種include,可以傳遞參數.
[color=red]<bean:include id="includedPage" page="a.jsp" />
<bean:write name="includedPage" filter="false" />[/color]
和jsp:include差不多,但印象中有不可取代的地方,不過忘了.....
想起來了:
[color=red]<bean:include id="includedPage" page="test.do/method=aa" />
<bean:write name="includedPage" filter="false" />[/color]
如果一定得用struts的forward方式來include,那就得這樣用了!!
本文介紹了JSP中三種不同的包含方式:靜態包含(使用<%includefile=a.jsp%>)、動態包含(使用<jsp:include page=a.jsp/>)及通過Struts框架實現的包含(使用<bean:include>)。靜態包含在編譯時執行,動態包含則在運行時執行,並能傳遞參數。
843

被折叠的 条评论
为什么被折叠?



