JSPì?×a·?ê?(2)
String info = (String)request.getAttribute("info");
?t£oresponse.sendRedirect()
ê??úó??§μ??ˉàà?÷??1¤×÷£?sendRedirect() ?éò?′?2?êy′?μY£?±èè?servlet?name=zhangsan
???¨?òoó?ú?ˉàà?÷μ??·à?é??á3??????¨?òò3??μ?URL
ày£o???¨?òjsp
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
response.sendRedirect("jsp/forward.jsp");
//?é′?2?
//response.sendRedirect("jsp/forward.jsp?name=zhangsan");
???¨?òservlet
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
response.sendRedirect("F");
//?é′?μY2?êy
//response.sendRedirect("F?name=zhagnsan");
}
±è??£o
a) á??????éò?êμ??ò3??μ?ì?×aforwardê?èY?÷?D????è¨μ?×a?ò£??ú?í?§???ˉàà?÷μ??·à??D2??á??ê?3?×a?òoóμ?μ??·
response.sendRedirect()?òê?íêè?μ?ì?×a£??ˉàà?÷???áμ?μ?ì?×aμ?μ??·£?2¢??D?·¢?í???óá′?ó£??a?ù£?′ó?ˉàà?÷μ?μ??·à??D?éò??′μ?ì?×aoóμ?á′?óμ??·
b) á??????éò?ì?×aμ?jsp?ò??servlet ???éò?′?μY2?êy
μ?response.sendRedirect()ì?×aoóoó??μ?′ú????2??á?ù?′DD
ày£o
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
相关新闻>>
- 发表评论
-
- 最新评论 更多>>