谁能给一个struts的html:multibox的例子,要求:分页显示,actionfrom action 页面里具有可以任意选取功能,有合适的就给分
解决方案 »
- 关于网络管理系统的求助
- 导出excel表格时打开excel表格总是会报“文件错误,可能某些数字格式已丢失”该怎么解决?
- webservice运行Netlogo程序有问题,求帮忙
- eclipse 中如何使用cvs的问题?
- 毕业设计急用(中文乱码处理)
- 高手请做答字符乱码的问题
- 关于JSP项目中用户数据库连接过多问题的讨论!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- 初次写了一个类,想封装一下数据库操作,JSP执行耗时增加很多?
- !!!熟悉Struts的朋友进来帮帮忙!!!真是对Struts又爱又恨啊! 一个与<logic:iterate>有关的问题,诚征解决方案!!解决马上结贴给分!!!
- 哪位说说怎样在resin 里安装java servlets 谢谢
- Applet问题 paint()函数是什么时候被调用的?
- struts下validator校验下range的使用
楼主【chbJava】截止到2008-07-03 16:32:21的历史汇总数据(不包括此帖):
发帖的总数量:1 发帖的总分数:20
结贴的总数量:1 结贴的总分数:20
无满意结贴数:0 无满意结贴分:0
未结的帖子数:0 未结的总分数:0
结贴的百分比:100.00% 结分的百分比:100.00%
无满意结贴率:0.00 % 无满意结分率:0.00 %
敬礼!
我不高兴写。。
你自己去搜索下把
进到 http://heisetoufa.ggblog.com/ 里
然后搜索multibox
下边这代码只是一部分,贴不全``
去 我blog里自己查吧ShowPermission.jsp<%@ page contentType="text/html; charset=gbk"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<title>JSP for ShowPermissionForm form</title>
</head>
<style type="text/css">
table#list {
border-top: 1px solid #000000;
border-left: 1px solid #000000;
border-collapse: collapse;
font-size: 11pt;
}
table#list td, table#list th {
border-bottom: 1px solid #000000;
border-right: 1px solid #000000;
padding-left: 5px;
padding-right: 5px;
}
table#list thead tr {
background-color: #0af0cd;
}
table#list td.permission {
text-align: center;
width: 70px;
}
</style>
<body>
<html:form action="/updatePermission" method="post">
<table id="list" cellspacing="0">
<thead>
<tr>
<td>选项</td>
<td>姓名</td>
<td width="100px">单位</td>
<td width="100px">部门</td>
<td>增加权限</td>
<td>删除权限</td>
<td>修改权限</td>
<td>查看权限</td>
</tr>
</thead>
<tbody>
<c:forEach items="${emps}" var="emp">
<tr>
<td><input type="checkbox" name="empIds" value="http://www.ygblog.com/${emp.empId}"></td>
<td>${emp.name}</td>
<td>${emp.unit}</td>
<td>${emp.division}</td>
<td><input type="checkbox" name="addPermissions" value="http://www.ygblog.com/${emp.empId}"<c:if test="${emp.addPermission == '1'}"> checked</c:if> /></td>
<td><input type="checkbox" name="deletePermissions" value="http://www.ygblog.com/${emp.empId}"<c:if test="${emp.deletePermission == '1'}"> checked</c:if> /></td>
<td><input type="checkbox" name="modifyPermissions" value="http://www.ygblog.com/${emp.empId}"<c:if test="${emp.modifyPermission == '1'}"> checked</c:if> /></td>
<td><input type="checkbox" name="viewPermissions" value="http://www.ygblog.com/${emp.empId}"<c:if test="${emp.viewPermission == '1'}"> checked</c:if> /></td>
</tr>
</c:forEach>
</tbody>
</table>
<html:submit value="更新" />
</html:form>
</body>
</html>ShowPermissionAction/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.struts.action;import java.util.ArrayList;
import java.util.List;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;import com.bean.Employee;public class ShowPermissionAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
List<Employee> emps = new ArrayList<Employee>();
Employee emp1 = new Employee("001", "Enjoy", "单位", "工程部", "0", "1", "1", "0");
Employee emp2 = new Employee("002", "joejoe", "单位", "工程部", "1", "0", "0", "0");
Employee emp3 = new Employee("003", "koko", "单位", "工程部", "1", "1", "1", "0");
Employee emp4 = new Employee("004", "pizzame", "单位", "工程部", "1", "0", "1", "1");
Employee emp5 = new Employee("005", "heisetoufa", "单位", "工程部", "1", "1", "0", "0");
emps.add(emp1);
emps.add(emp2);
emps.add(emp3);
emps.add(emp4);
emps.add(emp5);
for(Employee emp : emps) {
System.out.println(emp);
}
request.setAttribute("emps", emps);
return mapping.findForward("showPermission");
}
}Employeepackage com.bean;public class Employee { private String empId;
private String name;
private String unit;
private String division;
private String addPermission;
private String deletePermission;
private String modifyPermission;
private String viewPermission;
public Employee(){
}
public Employee(String empId, String name, String unit, String division, String addPermission, String deletePermission, String modifyPermission, String viewPermission) {
this.empId = empId;
this.name = name;
this.unit = unit;
this.division = division;
this.addPermission = addPermission;
this.deletePermission = deletePermission;
this.modifyPermission = modifyPermission;
this.viewPermission = viewPermission;
}
public String getAddPermission() {
return addPermission;
}
public void setAddPermission(String addPermission) {
this.addPermission = addPermission;
}
public String getDeletePermission() {
return deletePermission;
}
public void setDeletePermission(String deletePermission) {
this.deletePermission = deletePermission;
}
public String getDivision() {
return division;
}
public void setDivision(String division) {
this.division = division;
}
public String getEmpId() {
return empId;
}
public void setEmpId(String empId) {
this.empId = empId;
}
public String getModifyPermission() {
return modifyPermission;
}
public void setModifyPermission(String modifyPermission) {
this.modifyPermission = modifyPermission;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getViewPermission() {
return viewPermission;
}
public void setViewPermission(String viewPermission) {
this.viewPermission = viewPermission;
}
public String toString() {
return String.format("%-5s %-10s %-10s %-10s %-3s %-3s %-3s %-3s", empId, name, unit, division, addPermission, deletePermission, modifyPermission, viewPermission);
}
}