1
我想在我的jsp頁面中使用RequestDispatcher的incluce方法。 問題是它沒有給出所需的輸出。jsp中的RequestDispatcher
這裏是我的代碼:
<%
out.println(" end");
out.println(" starts");
RequestDispatcher rd=request.getRequestDispatcher("myfile.jsp");
rd.include(request,response);
%>
和myfile.jsp:
<%="good"%>
這是給輸出:
好下場開始
但我希望輸出成爲: 結束開始好。
任何人都可以解釋。 感謝
但如果我在servlet中使用相同的語句,說myserv.java然後它會生成預期的響應。爲什麼? – Himanshu
看到[this](http://stackoverflow.com/questions/3106452/how-do-servlets-work-instantiation-session-variables-and-multithreading)和[this](http://stackoverflow.com/questions/2095397/what-is-the-difference-between-jsf-servlet-and-jsp/2097732#2097732)知道servlet和jsp如何正常工作 –
我的問題是爲什麼它先執行請求調度程序,即使它是在後面寫入的。 – Himanshu