用javabean在JSP页面中实现进度条效果
public class TaskBean extends Thread{
public TaskBean(){
}
private int percent=0;
private boolean complete=false;
public synchronized void run() {
while(true){
if(percent>=100){
complete=true;
return;
}
try {
Thread.sleep(1000);
} catch (Exception e) {
System.err.println("TaskBean.run()"+e.getMessage());
}
percent+=10;
}
}
public boolean isComplete(){
return complete;
}
public int getPercent(){
return percent;
}
}
start.jsp
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<html>
<head>
<base href="<%=basePath%>">
&n
相关文档:
tomcat 默认使用的字符集是ISO-8859-1,不支持中文字符,所以在现实中文时需要转换字符和设置字符集。
server.mxl改为<Connector port="8080" protocol="HTTP/1.1" maxThreads="150" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" /> ,添加代码转换字符String.getBytes("ISO-8859-1"),"UTF-8 ......
源代码,a.jsp往b.jsp传值:
a.jsp页面内容
<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<form action="b.jsp">
name:<input type=text name=name>
<input type=submit>
</form>
b.jsp页面内容:
<%@ page language="java" import="java.ut ......
1.
最基本的乱码问题。
这个乱码问题是最简单的乱码问题。一般新手会出现。就是
页面编码不一致导致的乱码。
<%@ page
language="java" pageEncoding="UTF-8"%>
<%@ page
contentType="text/html;charset=iso8859-1"%>
<html>
<head>
<title> ......
<?xml version="1.0" encoding="UTF-8"?>
<%@ page contentType="text/html; charset=UTF-8" language="java" import="java.sql.*" errorPage="" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+pat ......
JS代码
<script
type="text/javascript">
function closewindow(){
window.returnValue = true;
window.close();
}
function clock(){
i = i -1;
if(document.getElementById("info")){
document.getElementById("info").innerHTML
......