在jsp里使用Cookie
写Cookie:
//从浏览器取得用户名
String username = request.getParameter("username");
//从浏览器取得密码
String password = request.getParameter("password");
//设置Cookie
Cookie userCookie = null;
Cookie passCookie = null;
//取得客户端的Cookie
//如果username和password满足条件则进入success.jsp
if ("admin".equals(username) && "1".equals(password)) {
userCookie = new Cookie("username", username);
passCookie = new Cookie("password", password);
userCookie.setMaxAge(20);
passCookie.setMaxAge(20);
response.addCookie(userCookie);
response.addCookie(passCookie);
response.sendRedirect("../success.jsp");
}
读Cookie:
String username = new String();
String password = new String();
//取得客户端的Cookie
Cookie[] cookies = request.getCookies();
//如果取得成功
if (cookies != null) {
相关文档:
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 fil ......
小弟最近公司做一个编辑器,最后选择用applet小程序嵌入jsp 中
相当于一个控制,总结分享一下:
主要碰到以下问题:
1,传参数问题:
applet-->jsp:
<applet code="rubikApp.class" archive="rubik.jar" width="300" height="300">
<param name="beta" ......
1、首先登陆www.fckeditor.net/download下载FCKeditor的最新版本,需要下载2个压缩包,一个是基本应用,另一个是在为在jsp下所准备的配置。
FCKeditor 2.6 下载地址:sourceforge.net/project/downloading.php
FCKeditor.Java 下载地址:sourceforge.net/ ......