today_jsp.java
来自「手机在线系统 采用Java 中的J2ME, JSP 跟MySql 运行环」· Java 代码 · 共 157 行
JAVA
157 行
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.io.*;
public final class today_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
String name;
String stringToUnicode(String s)
{
if (s == null)
{
return null;
}
StringBuffer result = new StringBuffer();
int i;
for (i = 0; i < s.length(); i++ )
{
if (s.charAt(i) >= 0x2018)
{
result.append('\\');
result.append('u');
String hex = Integer.toHexString(s.charAt(i));
result.append(hex);
}
else if (s.charAt(i) == 0x005c)
{
result.append("\\u005c");
}
else
{
result.append(s.charAt(i));
}
}
return result.toString();
}
public static String unicodeToString(String s)
{
if (s == null)
{
return null;
}
StringBuffer result = new StringBuffer();
int tempI, i, j, ch;
for (i = 0; i < s.length(); i++ )
{
if ((ch = s.charAt(i)) == '\\')
{
tempI = i;
i+=2;
while (s.length() > i && s.charAt(i) == 'u')
{
i++;
}
if (s.length() >= i + 4)
{
ch = Integer.parseInt(s.substring(i, i+4), 16);
i+=3;
}
else
{
i = tempI;
}
}
result.append((char)ch);
}
return result.toString();
}
private static java.util.Vector _jspx_dependants;
public java.util.List getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html; charset=gb2312");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("\r\n");
out.write('\r');
out.write('\n');
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
String MIDP_USER_AGENT = "Profile/MIDP-1.0 Configuration/CLDC-1.0";
String ua = request.getHeader("User-Agent");
String name = request.getParameter("name");
byte[] tmpbyte=name.getBytes("8859_1");
name = new String(tmpbyte);
name = stringToUnicode(name);
if (MIDP_USER_AGENT.equals(ua))
{
String n = "饶荣庆";
// String wu ="饶发生de事情";
// out.println(wu);
out.println(name);
n = stringToUnicode(n);
out.println(n);
out.println("raofdsaf");
}
else
{
String w ="发生发生";
w = stringToUnicode(w);
out.print(w);
java.util.Date today = new java.util.Date();
out.println("Got: " + name);
out.println("Date&time: " + today);
}
out.write(' ');
out.write('\r');
out.write('\n');
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
}
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?