技术标签: 2018
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'list.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript" src="js/jquery-1.8.2.js"></script>
<script type="text/javascript">
function gopage(cpage){
var mohu = $("#mohu").val();
location="student?m=list&cpage="+cpage+"&mohu="+mohu;
}
function jumppage(){
var cpage = $("#d1").val();
if(cpage>=1 && cpage<= "${pu.totalpage}"){
gopage(cpage);
}else{
alert("输入有误");
}
}
function mohu(){
var mohu = $("#mohu").val();
location="student?m=list&mohu="+mohu;
}
</script>
</head>
<body>
<table>
<tr>
<th colspan="21">
<input type="text" id="mohu" value="${mohu}">
<input type="button" value="搜索" onclick="mohu()">
</th>
</tr>
<tr>
<th>id</th>
<th>name</th>
<th>sex</th>
<th>age</th>
</tr>
<c:forEach var="s" items="${stulist}">
<tr>
<th>${s.id}</th>
<th>${s.name}</th>
<th>${s.sex}</th>
<th>${s.age}</th>
</tr>
</c:forEach>
<tr>
<th colspan="21">
<button onclick="gopage(1)">首页</button>
<button onclick="gopage(${pu.prevpage})">上页</button>
<button onclick="gopage(${pu.nextpage})">下页</button>
<button onclick="gopage(${pu.totalpage})">尾页</button>
<input type="text" id="d1" value="${pu.cpage}" style="width:30px;">
/${pu.totalpage}页
<input type="button" value="跳" onclick="jumppage()">
</th>
</tr>
</table>
</body>
</html>
package com.www.util;
public class PageUtils {
private Integer cpage;
private Integer pageSize;
private Integer count;
private Integer totalpage;
private Integer startIndex;
private Integer prevpage;
private Integer nextpage;
public PageUtils(Integer cpage, Integer pageSize, Integer count) {
this.cpage = cpage;
this.pageSize = pageSize;
this.count = count;
calprevpage();
calstartIndex();
caltotalpage();
calnextpage();
}
private void caltotalpage(){
this.totalpage = count/pageSize + (count%pageSize==0?0:1);
}
private void calstartIndex(){
this.startIndex = (cpage-1)*pageSize;
}
private void calprevpage(){
this.prevpage = cpage == 1?1:(cpage-1);
}
private void calnextpage(){
this.nextpage = cpage.equals(totalpage)?totalpage:(cpage+1);
}
public Integer getCpage() {
return cpage;
}
public void setCpage(Integer cpage) {
this.cpage = cpage;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
public Integer getTotalpage() {
return totalpage;
}
public void setTotalpage(Integer totalpage) {
this.totalpage = totalpage;
}
public Integer getStartIndex() {
return startIndex;
}
public void setStartIndex(Integer startIndex) {
this.startIndex = startIndex;
}
public Integer getPrevpage() {
return prevpage;
}
public void setPrevpage(Integer prevpage) {
this.prevpage = prevpage;
}
public Integer getNextpage() {
return nextpage;
}
public void setNextpage(Integer nextpage) {
this.nextpage = nextpage;
}
}
package com.www.dao;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import com.www.entity.Student;
import com.www.util.PageUtils;
public class StudentDao {
public List<Student> stulist(PageUtils pu, String mohu) {
// TODO Auto-generated method stub
List<Student> stulist = new ArrayList();
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql:///cms01","root","root");
String sql = "select * from student ";
if(mohu != null){
sql += " where name like '%"+mohu+"%' ";
}
sql += " limit "+pu.getStartIndex()+","+pu.getPageSize();
PreparedStatement pst = con.prepareStatement(sql);
ResultSet rs = pst.executeQuery();
while(rs.next()){
stulist.add(new Student(rs.getInt("id"),rs.getString("name"),rs.getString("sex"),rs.getInt("age")));
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return stulist;
}
public Integer count(String mohu) {
// TODO Auto-generated method stub
Integer count = null;
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql:///cms01","root","root");
String sql = "select count(*) from student ";
if(mohu != null){
sql += " where name like '%"+mohu+"%' ";
}
PreparedStatement
pst = con.prepareStatement(sql);
ResultSet rs = pst.executeQuery();
if(rs.next()){
count = rs.getInt(1);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return count;
}
}
package com.www.entity;
public class Student {
private int id;
private String name;
private String sex;
private int age;
public Student() {
super();
// TODO Auto-generated constructor stub
}
public Student(int id, String name, String sex, int age) {
super();
this.id = id;
this.name = name;
this.sex = sex;
this.age = age;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
@Override
public String toString() {
return "Student [id=" + id + ", name=" + name + ", sex=" + sex
+ ", age=" + age + "]";
}
}
package com.www.service;
import java.util.List;
import com.www.dao.StudentDao;
import com.www.entity.Student;
import com.www.util.PageUtils;
public class StudentService {
StudentDao dao = new StudentDao();
public List<Student> stulist(PageUtils pu, String mohu) {
// TODO Auto-generated method stub
return dao.stulist(pu,mohu);
}
public Integer count(String mohu) {
// TODO Auto-generated method stub
return dao.count(mohu);
}
}
package com.www.servlet;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.www.entity.Student;
import com.www.service.StudentService;
import com.www.util.PageUtils;
public class StudentServlet extends HttpServlet {
StudentService service = new StudentService();
@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
String m = request.getParameter("m");
if("list".equals(m)){
list(request,response);
}
}
private void list(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String mohu = request.getParameter("mohu");
System.out.println("1"+mohu);
String cpage = request.getParameter("cpage");
if(cpage==null){
cpage="1";
}
Integer pageSize = 2;
Integer count = service.count(mohu);
PageUtils pu = new PageUtils(Integer.valueOf(cpage),pageSize,count);
//Integer totalpage = count/pageSize + (count%pageSize==0?0:1);
List<Student> stulist = service.stulist(pu,mohu);
request.setAttribute("stulist", stulist);
request.setAttribute("pu", pu);
request.setAttribute("mohu", mohu);
request.getRequestDispatcher("list.jsp").forward(request, response);
}
}
人的觉醒是在对旧传统旧信仰旧价值旧风习的破坏、对抗和怀疑中取得的。
——李泽厚《美的历程》
文章浏览阅读2.4k次。在确定前台和后台控制器方法代码问题的情况下,检查方法中是不是包含了过多的$this->redirect()方法调用。使用过多的此方法会导致此问题,可以改用success和error来跳转页面。_thinkphp3.2 302 found
文章浏览阅读737次。在小刘拿到offer的那天下午,他打了个电话给我。他诉说着对我的感谢,吐槽面试遇到的奇葩事儿,最后,他激动的说:建哥,我终于不用担心变成失业人员了!在这里插入图片描述找工作有多可怕?小刘是我亲自带的第一届实习生,他聪慧,一点就透;踏实,不懂就问,不会就学。这个是我对他的实习评价。在期间,我帮他修改了春招的第一份网申简历。接下来的5个月里,他和我的沟通最多的就是“找工作”。在此之前,我并不清楚应届生找工作是这么“可怕”的事。“校招”的时候他错过了,随便投了几份简历,止步于二面或者三面,彻彻底底的错_字节跳动 java 应届
文章浏览阅读3.9k次。下面,我们开始iScroll之旅,请系好安全带。iScroll简介iScroll是一个高性能,资源占用少,无依赖,多平台的javascript滚动插件。它可以在桌面,移动设备和智能电视平台上工作。它一直在大力优化性能和文件大小以便在新旧设备上提供最顺畅的体验。iScroll不仅仅是 滚动。它可以处理任何需要与用户进行移动交互的元素。在你的项目中包含仅_iscroll 图片跳跃
文章浏览阅读2k次。PowerDesigner对数据库反向建立PDM可以使用sql方式,这个很简单,直接导入建表sql文件就可以了。要说的是使用数据库做源的建模方式,以前弄过一次,很久没弄忘了,这次要弄在网上搜了一下,结果不太满意,于是自己重新整理了一个步骤,贴出来共享一下,也算给自己做个备忘。 注意事先安装好Oracle客户端,并且正确配置好tns。 1、 新建PDM:选择菜单File->N_powerdesign 从数据库导出物理模型
文章浏览阅读2w次,点赞4次,收藏45次。1. 安装VMware请自行下载安装 VMware 16.2 及以上版本2. img 镜像转 vmdk 格式下载的 vmdk 格式的系统,请忽略此步下载的 img 格式的系统,请自行下载 StarWind V2V Image Converter 工具将其转换为 vmdk 格式,下载链接如下https://www.starwindsoftware.com/tmplink/starwindconverter.exe3. 创建 OpenWrt 虚拟机创建虚拟机使用自定义模式使用兼容_openwrt旁路由无法上网
文章浏览阅读9.6k次。【转】http://f.dataguru.cn/thread-454328-1-1.html一.原因: sql语句里边使用 'Y' 'N' 给boolean类型的赋值产生sql失败 二.解决方法:将insert语句中‘Y’或‘N’ 改成TRUE或FALSE即可,共两张表3个地方(1)INSERT INTO R_VERSION(ID_VERSION, MAJOR_VE_spoon couldn't execute sql
文章浏览阅读2k次。df1 = DataFrame([['a', 10, '男'],['b', 11, '男'],['c', 11, '女'],['a', 10, '女'],['c', 11, '男']],columns=['name', 'age', 'sex'])df2 = DataFrame([['a', 10, '男'],..._pandas 取差集
文章浏览阅读4.2k次,点赞4次,收藏37次。Android Camera硬件结构组成(一)之 手机摄像头的组成结构和工作原理参考网址:1、https://www.cnblogs.com/straybirds/p/7350535.html2、http://www.360doc.com/content/14/0421/15/5896561_370845066.shtml手机摄像头由:PCB板、镜头、固定器和滤色片、DSP(..._安卓摄像头原理
文章浏览阅读827次。使用Spring Tool Suite4来搭建基于Gradle的springboot工程_spring tools怎么用gradle
文章浏览阅读448次。1衡量不同单位经营业绩,最直接、最有效的方法是选取( )进行计量。A货币B实物C时间D劳动错误正确答案:左边查询学生答案:B2下列属于会计对经济活动的合法性进行审查的是,各项经济活动是否( )。A符合经济运行客观规律B遵守国家各项方针政策C符合单位的内部管理要求D有利于经营目标或预算目标的实现正确正确答案:左边查询学生答案:B3下列各项中,属于会计核算最终环节的是( )。A确认B计量C记录D报告错误正确答案:左边查询学生答案:C4下列关于会计监督职能的表述中,_单位6月份预付第三季度财产保险费1 800元;支付本季度借款利息3 900元(其中5月
文章浏览阅读3.2k次。官网网址:Download | The Scala Programming Language这里以下载scala-2.11.8为例1.首先进入官网下载页面,上面网址2.然后一直往下面滑,找到All previous releases3.这里就有全部scala的版本4.选择我们需要的版本,滑到下面找到Other resources5.选择tgz的版本下载就好了..._scala下载官网
文章浏览阅读567次。S3C6410的 NAND 驱动以 platform驱动的形式存在。 static int __init s3c_nand_init(void){ printk("S3C NAND Driver, (c) 2008 Samsung Electronics\n"); platform_driver_register(&s3c2450_nand_driver); platform__error: unknown type name ‘void_exit’ static void_exit cleanup_procfs_examp