简单Ajax与JSP相结合页面
环境:Ajax+JSP,Tomcat5.05
参考:http://www.w3cschool.cn/index-24.asp.htm
文件:testAjax.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<mce:script type="text/javascript"><!--
function ajaxFunction(){
var xmlHttp;
try{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}catch (e){
// Internet Explorer
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}catch (e){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}catch (e){
alert("您的浏览器不支持AJAX!");
return false;
}
}
}
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
document.myForm.time.value=xmlHttp.responseText;
}
}
xmlHttp.open("GET","time.jsp",true);
xmlHttp.send(null);
}
function clearText(){
document.myForm.time.value="";
}
// --></mce:script>
<form name="myForm">
用户: <input type="text" name="username" onMouseOver="ajaxFunction()" onMouseOut="clearText()" size="50">
<p>
时间: <textarea name="time" rows="5" cols="50">
time.jsp
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<%
java.io.PrintWriter myOut = response.getWriter();
java.util.Date d = new java.util.Date();
java.text.SimpleDateFormat f = new java.text.SimpleDateFormat("yyyy年MM月dd日 hh:mm:ss");
myOut.print(f.format(d));
myOut.flush();
my
相关文档:
1.FCKeditor 介绍
FCKeditor 这个开源的HTML 文本编辑器可以让web 程序拥有如MS Word 这样强大的编辑功能,.FCKeditor 支持当前流行的浏览器。
2.准备工作:
环境:winddows XP、tomcat6.0、JDK1.6
下载:
1):FCKeditor_2.6.4.zip
地址:http://nchc.dl.sourceforge.net/sourceforge/fckeditor/FCKeditor_2.6.4.zip ......
在线网页编辑器中最著名的是fckEditor,但他的功能太全面了,而且使用起来也不是很方便。相对而言新浪htmleditor就比较清爽,而且使用简单。新浪博客和人人网日志应该都是用的这个控件。但是htmleditor最多的是asp版本,在网站jsp版本十分稀少。通过查找我找到一个可以使用的新浪htmleditor jsp版本。下载地址为http://down ......
由于要做上传 就找了个例子 留着参考
上传:需要smartupload组件
import com.jspsmart.upload.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
/**
* 上传公共类,对SmartUpload进行了封装
* ......
在web.config中修改修改属性
1:<configSections><configSections>中加下面代码
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral ......
<html>
<head>
<title>new ajax</title>
<mce:style type="text/css"><!--
body{
margin-top:50px;
}
.MyDiv{
font-size:12px;
border:1px solid #DDD;
background-color:#FFD;
margin:2px;
width:200px;
}
--></mce:style><style type="t ......