随笔分类 - Java Web案例分析
摘要:文件上传中,我们会遇到很多问题,例如:1、上传文件名的中文乱码和上传数据的中文乱码: upload.setHeaderEncoding("UTF-8"); //解决上传文件名的中文乱码 //表单为文件上传,设置request编码无效,只能手工转换 1.1 value = new String(value.getBytes("iso8859-1"),"UTF-8"); 1.2 String value = item.getString("UTF-8");2.为保证服务器安全,上传文件应该放在外界无法直接访问的目录3、
阅读全文
摘要:A tag library exercising SimpleTag handlers. 1.0 SimpleTagLibrary /itcast subString cn.itcast.web.el.ElUtils java.lang.String subString( java.lang.String,java.lang.Integer ) A tag library exercising SimpleTag handlers. 1.0 SimpleTagLibra...
阅读全文
摘要:更新用户 客户姓名 性别 男 女 生日 年 ...
阅读全文
摘要:显示所有用户 客户姓名 性别 生日 手机号码 邮箱 爱好 类型 备注 操作 ...
阅读全文
摘要:添加客户 客户姓名 性别 男 女 生日 年 月 ...
阅读全文
摘要:当前第[${page.pagenum }]页 首页 1}"> 上一页 [${pagenum }] 下一页 末页 共[${page.totalpage }]页,共[${page.totalrecord}]纪录,
阅读全文
摘要://page初始调用function pageInit(){ makeYear(); makeMonth(); makeDay(); }//产生Yearfunction makeYear(){ var year = document.getElementById("year"); for(var i=1901;i<=new Date().getYear();i++){ var option = document.createElement("option"); option.value = i; op...
阅读全文
摘要:package cn.itcast.web.controller;import java.io.IOException;import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import cn.itcast.domain.Customer;import cn.itcast.serivce.BusinessService
阅读全文
摘要:package cn.itcast.utils;import java.util.Date;import java.util.Enumeration;import java.util.UUID;import javax.servlet.http.HttpServletRequest;import org.apache.commons.beanutils.BeanUtils;import org.apache.commons.beanutils.ConvertUtils;import org.apache.commons.beanutils.locale.converters.DateLocal
阅读全文
摘要:package cn.itcast.utils;import java.io.InputStream;import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;import java.util.Properties;public class JdbcUtils { private static String url = null; private static...
阅读全文
摘要://得到总记录数 public int getTotalrecord(){ Connection conn = null; PreparedStatement st = null; ResultSet rs = null; try{ conn = JdbcUtils.getConnection(); String sql = "select count(*) from customer"; st = conn.prepareStatement(sql); ...
阅读全文
摘要://获取分页数据 public List getPageData(int startindex,int pagesize){ Connection conn = null; PreparedStatement st = null; ResultSet rs = null; try{ conn = JdbcUtils.getConnection(); String sql = "select * from customer limit ?,?"; st = conn.p...
阅读全文
摘要:public Customer find(String id){ Connection conn = null; PreparedStatement st = null; ResultSet rs = null; try{ conn = JdbcUtils.getConnection(); String sql = "select * from customer where id=?"; st = conn.prepareStatement(sql); ...
阅读全文
摘要:public void delete(String id){ Connection conn = null; PreparedStatement st = null; ResultSet rs = null; try{ conn = JdbcUtils.getConnection(); String sql = "delete from customer where id=?"; st = conn.prepareStatement(sql); st....
阅读全文
摘要:public void update(Customer c){ Connection conn = null; PreparedStatement st = null; ResultSet rs = null; try{ conn = JdbcUtils.getConnection(); String sql = "update customer set name=?,gender=?,birthday=?,cellphone=?,email=?,preference=?,type=?,desc...
阅读全文
摘要:public List getAll(){ Connection conn = null; PreparedStatement st = null; ResultSet rs = null; try{ conn = JdbcUtils.getConnection(); String sql = "select * from customer"; st = conn.prepareStatement(sql); rs = st.execu...
阅读全文
摘要:public void add(Customer c){ Connection conn = null; PreparedStatement st = null; ResultSet rs = null; try{ conn = JdbcUtils.getConnection();//工具类jdbcUtils,连接数据库,三层架构思想体现非常重要 //此方法预防sql注入,采用prepareStatement ,注意SQL 代码的写法 String sql = "in...
阅读全文
摘要:1.搭建开发环境 1.1 导入项目所需的开发包: dom4j-1.6.1.jar jaxen-1.1-beta-6.jar commons-beanutils-1.8.0.jar commons-logging.jar jstl.jar standard.jar 1.2 创建程序的包名 1.3 在类目录下面,创建用于保存用户数据的xml文件(users.xml)-- 简单实现XML代替数据库users.xml<?xml version="1.0" encoding="UTF-8"?><users> <user id=&quo
阅读全文
浙公网安备 33010602011771号