1. Can be used:
2. The Location attribute of the HTTP header can be modified manually, as follows:
3. You can also use forward:
Please note: This method can only be used before any output has been sent to the client.
5.6 Similar practices
The counterpart that is not available in JSP. But there can be a workaround to run. For example, if you need to store or access the application scope variable, you can always create a Javabean and include it where those variables are needed in the page.
However, there are also some products that have such correspondence:
Allaire's product JRun 3.0 will be available. JRun 2.3.3 is still supported, but only for JSP 0.92. When JRun 3.0 is finally launched, it will support for JSP 1.0 and 1.1.
You can get JRun 3.0 beta 5 from /jrun30
In addition, Oracle's JSP support.
5.7 jsp displays the current time
5.8 Create a directory in JSP Mkdir(String path)
5.9 Turn return to the <br> function
("/path/"); |
2. The Location attribute of the HTTP header can be modified manually, as follows:
<% (HttpServletResponse.SC_MOVED_PERMANENTLY); String newLocn = "/newpath/"; ("Location",newLocn); %> |
3. You can also use forward:
<jsp:forward page="/" /> |
Please note: This method can only be used before any output has been sent to the client.
5.6 Similar practices
The counterpart that is not available in JSP. But there can be a workaround to run. For example, if you need to store or access the application scope variable, you can always create a Javabean and include it where those variables are needed in the page.
<jsp:useBean scope="application" class=""/> |
However, there are also some products that have such correspondence:
Allaire's product JRun 3.0 will be available. JRun 2.3.3 is still supported, but only for JSP 0.92. When JRun 3.0 is finally launched, it will support for JSP 1.0 and 1.1.
You can get JRun 3.0 beta 5 from /jrun30
In addition, Oracle's JSP support.
5.7 jsp displays the current time
<%@ page import=".*, .*" %> <HTML> <HEAD> <TITLE>JSP to display the current time</TITLE> </HEAD> <BODY> The current time is: <% Date now = new Date(); (().format(now)); %> </BODY> </HTML> |
5.8 Create a directory in JSP Mkdir(String path)
<%@ page import=".*" %> <%! String Mkdir(String path) { String msg=null; dir; // Create a new file object dir =new (path); if (dir == null) { msg = "Error reason: <BR> Sorry, you cannot create an empty directory!"; return msg; } if (()) { msg = "Cause of error: <BR> There is already a file with the same name <B>" + () + "</B> exists."; return msg; } if (!()) { boolean result = (); if (result == false) { msg = "Error reason: <BR> directory <b>" + () + "</B> failed to create, unknown reason!"; return msg; } // If the directory is successfully created, no output is available. // msg ="Successfully created directory: <B>" + () + "</B>"; return msg; } else { msg = "Cause of error: <BR> directory <b>" + () + "</b> already exists."; } return msg; } %> <% String filepath = "/usr/home/hoyi/html/dir"; String opmsg = Mkdir(filepath); %> |
5.9 Turn return to the <br> function
public static String returnToBr(String sStr) { if (sStr == null // ("")) { return sStr; } String sTmp = new String(); int i = 0; while (i <= ()-1) { if ((i) == '\n') { sTmp = ("<br>"); } else { sTmp = ((i,i+1)); } i++; } return sTmp; } |