<%
//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 ......
1、 在JSP文件上使用标签库
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
时出现问题,错误信息如下:
he absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
原因:Tomcat5.0的组件库里缺了两个包,jtsl1.2.jar和stanard.jar
解决方法:把Tomcat升级到6.0 ......
解决方法:
第一种:在Action中用 new String(str.getBytes("ISO8859_1"), "UTF8"),进行转码,因为传递的时候,中文默人的是ISO8859_1
第二种:可通过配置TOMCAT来解决此问题,具体解决方法如下:在tomcat的server.xml里,找到<Connector port="8080" useBodyEncodingForURI="true" URIEncoding="utf-8">
其中是修改useBodyEncodingForURI="true" URIEncoding="utf-8" 其方法是防止在url中出现乱码
然后在每个Jsp页面添加如下代码
<%@ page pageEncoding=” utf-8″%>
<%@ page contentType=”text/html;charset= utf-8″%>
<%request.setCharacterEncoding(” utf-8″);%> ......
JSP元素包括:1、脚本元素(语言为Java,使用Java代码规范。其中<%!声明(变量、方法)%><%=表达式元素%><%程序代码%>)
2、指令元素:指定网页中的指令如何被执行,包括page和include。
3、动作元素:连接要用的组件,如JavaBean(useBean、get/setProperty),还有param、forward、include。
include指令元素实在将JSP转译成Servlet时,插入另一文件的内容,所以当另一文件中的内容改变时,不会反映当前网页。而include动作元素实在进行页面请求时,插入另一文件中的内容,所以当另一文件中的内容改变时,会反映到当前网页。前者为静态加载,后者为动态加载。 ......
通过Server视图部署web项目时,有时会发现,tomcat的 webapps目录下,项目文件夹中,只有web-inf文件夹,并且里面只有lib文件夹,这时,只要进入构建路径窗口,选择source选项卡,然后将除了src外的其他删除掉,从新部署一下项目就可以了,最后只剩下src文件夹,O(∩_∩)O~不知道如何传图片,所以….. ......
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-520092929 1073786111 9 0 415 0;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qf ......