JSP/Java获取HTTP header信息(request)例子
<%
//header.jsp
out.println("Protocol: " + request.getProtocol() + "<br>");
out.println("Scheme: " + request.getScheme() + "<br>");
out.println("Server Name: " + request.getServerName() + "<br>" );
out.println("Server Port: " + request.getServerPort() + "<br>");
out.println("Protocol: " + request.getProtocol() + "<br>");
out.println("Server Info: " + getServletConfig().getServletContext().getServerInfo() + "<br>");
out.println("Remote Addr: " + request.getRemoteAddr() + "<br>");
out.println("Remote Host: " + request.getRemoteHost() + "<br>");
out.println("Character Encoding: " + request.getCharacterEncoding() + "<br>");
out.println("Content Length: " + request.getContentLength() + "<br>");
out.println("Content Type: "+ request.getContentType() + "<br>");
out.println("Auth Type: " + request.getAuthType() + "<br>");
out.println("HTTP Method: " + request.getMethod() + "<br>");
out.println("Path Info: " + request.getPathInfo() + "<br>");
out.println("Path Trans: " + request.getPathTranslated() + "<br>");
out.println("Query String: " + request.getQueryString() + "<br>");
out.println("Remote User: " + request.getRemoteUser() + "<br>");
out.println("Session Id: " + request.getRequestedSessionId() + "<br>");
out.println("Request URL: " + request.getRequestURL() + "<br>");
out.println("Request URI: " + request.getRequestURI() + "<br>");
out.println("Servlet Path: " + request.getServletPath() + "<br>");
out.println
相关文档:
1.八进制转义序列:\ + 1到3位5数字;范围'\000'~'\377'
\0:空字符
2.Unicode转义字符:\u + 四个十六进制数字;0~65535
\u0000:空字符
3.特殊字符:就3个
\":双引号
\':单引号
&nbs ......
转载:
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/xuchanghao/archive/2009/01/16/3796276.aspx
一、多种方式读文件内容。
1、按字节读取文件内容
2、按字符读取文件内容
3、按行读取文件内容
4、随机读取文件内容
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputS ......
一、多种方式读文件内容。
1、按字节读取文件内容
2、按字符读取文件内容
3、按行读取文件内容
4、随机读取文件内容
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java ......
我把index.jsp文件放到WEB-INF下,又在WEB-INF下建立一个目录js用来放javascript文件,也就是说index.jsp和js目录是平级的,但是在index.jsp下引用javascript文件时怎么也找不到。
WEB-INF对于用户(也就是IE)不可见。
对策,把js放到WEB-INF外,或者通过专门的jsp/servlet/action等forward到相应的资源。 ......