zTree & ckeditor &ValidateCode.jar 使用个人心得总结
2024-09-03 05:05:22
zTree:依靠 jQuery 实现的多功能 “树插件”。
使用时只需要将下载的压缩包接用,复制里边的css 和 js 到指定目录即可。
如图所示:
在zTree的官网可以找到各种类型树的示例:
地址如下:http://www.treejs.cn/v3/demo.php
当下载压缩包之后再相应的路径都可以找到相应的html文件,直接拿来用就欧克。
再使用给出的html示例时要更改引入的路径才能正确使用
验证路径的方式是 按住CTRL 键时鼠标移到 href 或者 src 的路径 会出现下划线,点击会进入相应的源码当中。
ckeditor: 再网上可以找到相应的压缩包,引入 ckeditor 文件,导入相应的 js,路径可能不对,按如上方法修改。
通过 CKEDITOR.replace('area') 实现 对 textarea 的替换。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
</head>
<body>
<textarea name="area"></textarea>
<script type="text/javascript">CKEDITOR.replace('area');</script>
</body>
</html>
效果图如下:
ValidateCode.jar 包是一个自动生成验证码的jar包。
使用时在Servlet 类中调用相关方法即可。
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import cn.dsna.util.images.ValidateCode; /**
* Servlet implementation class Servlet2
*/
@WebServlet("/Servlet2")
public class Servlet2 extends HttpServlet {
private static final long serialVersionUID = 1L; /**
* @see HttpServlet#HttpServlet()
*/ public Servlet2() {
super();
// TODO Auto-generated constructor stub
} /**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
//1.设置验证码图片的宽高
int width=120;
int height=50;
//2.生成验证码 参数1和2:宽和高 参数3:验证码的位数(一般是4位,比如7RV4,G86T等等) 参数4:干扰线的条数
ValidateCode code=new ValidateCode(width, height, 6, 4);
//3.输出验证码图片
code.write(response.getOutputStream()); //4.将随机码存起备用
String codeString=code.getCode();
System.out.println("====codeString======"+codeString);
} /**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
} }
jsp:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>生成验证码</title>
</head>
<body>
<div align="center">
<!-- 调用Servlet2 类中的方法 -->
<img src="Servlet2">
</div>
</body>
</html>
效果图如下:
最新文章
- 博客整理——Alpha版冲刺
- UDP协议开发
- C# tabconctrol切换事件
- 关于Unity中Camera的Aspect
- J1签证办理全过程
- webstorm查看angular2的ts源码
- linux驱动系列之makefile
- Oracle数据库字符串连接方法
- C语言_double_精度的谜团
- WPF 3D:简单的Point3D和Vector3D动画创造一个旋转的正方体
- JavaWeb之JSP技术总结
- python_猜年龄
- 0418 jQuery笔记(添加事件、each、prop、$(this))
- CSS--外发光与内阴影
- 五. Python基础(5)--语法
- http_build_query用法,挺方便的
- ACM~排列组合&;amp;&;amp;hdu例子
- mysql ssh 端口转发
- Var与Dynamic的区别
- 封装libsvm成可程序调用的C/C++类
热门文章
- [CodeForces]1263A Sweet Problem
- 原型与继承与class
- python爬虫破解带有RSA.js的RSA加密数据的反爬机制
- Phoenix5.0的部署
- 吴裕雄 Bootstrap 前端框架开发——Bootstrap 字体图标(Glyphicons):glyphicon glyphicon-step-forward
- 51nod 1437:迈克步 单调栈基础题
- HihoCoder第十三周:最近公共祖先 一
- 中文文本分类之CharCNN
- 五十五、SAP中调用系统自带的函数
- 114-PHP判断类变量是否相同