<%
List list = new ArrayList();
list.add(new Student("001","xiaocheng"));
list.add(new Student("002","xiaoli"));
list.add(new Student("003","xiaowang"));
request.setAttribute("stus", list);
%>
checkbox标签
助手类
package com.jsp.day01;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.BodyTagSupport;
public class CheckboxTag extends BodyTagSupport {
private String textKey;//传入值
private String textVal;//显示值
private List checkedVal=new ArrayList<>();//回显数据集合
private List item=new ArrayList<>();//数据集合
public List getItem() {
return item;
}
public void setItem(List item) {
this.item = item;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTextKey() {
return textKey;
}
public List getCheckedVal() {
return checkedVal;
}
public void setCheckedVal(List checkedVal) {
this.checkedVal = checkedVal;
}
public void setTextKey(String textKey) {
this.textKey = textKey;
}
public String getTextVal() {
return textVal;
}
public void setTextVal(String textVal) {
this.textVal = textVal;
}
public CheckboxTag() {
super();
}
public CheckboxTag(String textKey, String textVal, List checkedVal, List item) {
super();
this.textKey = textKey;
this.textVal = textVal;
this.checkedVal = checkedVal;
this.item = item;
}
@Override
public int doStartTag() throws JspException {
JspWriter out = pageContext.getOut();
try {
out.print(toHTML());
} catch (IOException e) {
e.printStackTrace();
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (SecurityException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return super.doStartTag();
}
private String toHTML() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
StringBuffer sb=new StringBuffer();
String value;
String html;
for (Object obj : item) {
//一样利用放射取属性值
Field textKeyfield = obj.getClass().getDeclaredField(textKey);
textKeyfield.setAccessible(true);
value=(String)textKeyfield.get(obj);
Field textValfield = obj.getClass().getDeclaredField(textVal);
textValfield.setAccessible(true);
html=(String)textValfield.get(obj);
if(checkedVal.contains(value)) {//判断回显集合里是否包含这个value,包含就设置选择
sb.append(""+html+"");
}
else {
sb.append(""+html+"");
}
}
return sb.toString();
}
}
<%
List list = new ArrayList();
list.add(new Student("001","xiaoaa"));
list.add(new Student("002","xiaoaa"));
list.add(new Student("003","xiaoaa"));
List l = new ArrayList();
l.add("001");
l.add("002");
request.setAttribute("list", list);
request.setAttribute("l", l);
%>
<script language="javascript">
$(function (){
var i = 4;$(window).bind("scroll", function (event){
//滚动条到网页头部的 高度,兼容ie,ff,chrome
var top = document.documentElement.s
包冲突是开发过程中很常见的问题:
其表现有:
1.明明在eclipse中能够索引到某个类,运行时却报出找不到类。
2.明明在eclipse中能够索引到某个类的方法,运行时却报出找不到方法。
3.类及方法都有,以正确编译成了.class文件,在本机跑的好好的,发到测试或者正式环境就
抛如下异常:
java.lang.NoClassDefFoundError: Could not in
NAME: gpasswd - administer the /etc/group file
SYNOPSIS:
gpasswd group
gpasswd -a user group
gpasswd -d user group
gpasswd -R group
gpasswd -r group
gpasswd [-A user,...] [-M user,...] g
enquiry mysql version in centos linux
yum list installed | grep mysql
yum -y remove mysql-libs.x86_64
enquiry mysql version in yum repositoryyum list | grep mysql oryum -y list mysql*
install mysq
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.
Below is one possible representation of s1 = "great":
select p.spid,c.object_name,b.session_id,b.oracle_username,b.os_user_name from v$process p,v$session a, v$locked_object b,all_objects c where p.addr=a.paddr and a.process=b.process and c.object_id=b.