response.sendredirect("http://www.foo.com/path/error.html"); |
<% response.setstatus(httpservletresponse.sc_moved_permanently); string newlocn = "/newpath/"; response.setheader("location",newlocn); %> |
<jsp: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>对不起,不能创建空目录!"; 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>创建失败,原因不明!"; return msg; } // 如果成功创建目录,则无输出。 // msg ="成功创建目录: <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; } |
如对本文有疑问, 点击进行留言回复!!
idea ssm项目java程序向串口发送指令并且使用十六进制 rxtx包的方法
网友评论