JSP文件
<%@ page language="java" import="kg.TestBean2;" %>
<%@ page contentType="text/html;charset=gb2312" %>
<html>
<head>
<title>HelloBean</title>
</head>
<body>
<%--
<%
kg.TestBean2 testbean=(kg.TestBean2)session.setAttribute("testbean");
if(testbean==null){
testbean = new kg.TestBean2();
session.setAttribute("testbean",testbean);
}
%>
--%>
<jsp:useBean id="testbean" class="kg.TestBean2" scope="page" />
<%--
<jsp:setProperty name="testbean" property="myText" />
<jsp:getProperty name="testbean" property="myText"/>
<jsp:setProperty name="testbean" property="myPassword"/>
<jsp:getProperty name="testbean" property="myPassword"/>
--%>
<jsp:setProperty name="testbean" property="*"/>
用户名:<%=new String(testbean.getMyText().getBytes("ISO8859_1"),"GBK")%>
密码:<%=testbean.getMyPassword()%>
</body>
</html>
相关文档:
<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>index</title>
<meta http-equiv="pragma" content="no-cache"&g ......
<%@ page contentType="text/html;charset=GBK"%>
<%@page import="java.util.*"%>
<%@page import="java.io.*" %>
<%
//在这里如果写成“WEB-INF\templates\template.htm”程序会报错
String filePath = request.getRealPath("/")+"WEB-INF/templates/template.htm"; &nbs ......
对于HTM网页,加入:
<meta HTTP-EQUIV="pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<meta HTTP-EQUIV="expires" CONTENT="0">
然后,jsp页面中加入:
<%
response.setHeader("Cache-Control","no-store") ......
<%@ page language="java" import="kg.TestBean2;" %>
<%@ page contentType="text/html;charset=gb2312" %>
<html>
<head>
<title>HelloBean</title>
</head>
<body>
<%--
<%
kg.TestBean2 testbean=(kg.TestBean2)session.setAttribute("testbean");
if ......