response.sendRedirect("http://www.foo.com/path/error.html"); |
<% response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); String newLocn = "/newpath/index.html"; response.setHeader("Location",newLocn); %> |
?。糺sp:forward page="/newpage.jsp" /> |
<jsp:useBean id="globals" scope="application" class="com.xxx.GlobalBean"/> |
<%@ page import="Java.util.*, Java.text.*" %> <HTML> <HEAD> <TITLE>JSP to display the current time</TITLE> </HEAD> <BODY> The current time is: <% Date now = new Date(); out.println(DateFormat.getTimeInstance().format(now)); %> </BODY> </HTML> |
<%@ page import="Java.io.*" %> <%! String Mkdir(String path) { String msg=null; Java.io.File dir; // 新建文件對象 dir =new Java.io.File(path); if (dir == null) { msg = "錯誤原因:<BR>對不起,不能創(chuàng)建空目錄!"; return msg; } if (dir.isFile()) { msg = "錯誤原因:<BR>已有同名文件<B>" + dir.getAbsolutePath() + "</B>存在。"; return msg; } if (!dir.exists()) { boolean result = dir.mkdirs(); if (result == false) { msg = "錯誤原因:<BR>目錄<b>" + dir.getAbsolutePath() + "</B>創(chuàng)建失敗,原因不明!"; return msg; } // 如果成功創(chuàng)建目錄,則無輸出。 // msg ="成功創(chuàng)建目錄: <B>" + dir.getAbsolutePath() + "</B>"; return msg; } else { msg = "錯誤原因:<BR>目錄<b>" + dir.getAbsolutePath() + "</b>已存在。"; } return msg; } %> <% String filepath = "/usr/home/hoyi/html/dir"; String opmsg = Mkdir(filepath); %> |
public static String returnToBr(String sStr) { if (sStr == null // sStr.equals("")) { return sStr; } String sTmp = new String(); int i = 0; while (i <= sStr.length()-1) { if (sStr.charAt(i) == '\n') { sTmp = sTmp.concat("<br>"); } else { sTmp = sTmp.concat(sStr.substring(i,i+1)); } i++; } return sTmp; } |
標(biāo)簽:北海 保定 廣元 吳忠 潮州 玉樹 肇慶 紹興
巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Jsp如何實現(xiàn)網(wǎng)頁的重定向》,本文關(guān)鍵詞 Jsp,如何,實現(xiàn),網(wǎng)頁,的,重定向,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。上一篇:JSP迅速入門
下一篇:JSP的login程序代碼