Action中的代码片段
public void setEpid(String epid) {
this.epid = epid;
}
public String edit() {
try {
if ("save".equals(save)) {//点击保存按钮的时候执行
return save();
} else {
loadInfo();
return RETURN_EDIT;
}
} catch (Exception e) {
super.printErrors(this.getRequest(), e, className);
return RETURN_ERROR;
}
}
private void loadInfo() throws Exception {
epid = this.getRequest().getParameter("id");//得到单个的epid
Long userid = getLoginUser().getUser().getUserID();
/**
功能:
得到单个对象 并把各个对象 放到VO对象中
页面中显示数据的值
**/
Ep ep = new Ep();
ep.setId(Long.parseLong(epid));
ep = epService.getEpById(ep);
epVO.setEp(ep);
// depart对象
Depart depart = new Depart();
depart.setDeptID(ep.getDeptid());
depart.setPlateNumber(ep.getName());
depart.setCreateBy(userid);
depart.setJudgeType(Integer.parseInt("0"));
String str[] = ep.getInfo().split(";");
String s1 = "";
for (int i = 0; i < str.length; i++) {
s1 = str[0];
}
if ("".equals(s1) || null == s1) {
depart.setRoute("暂无路线");
} else {
depart.setRoute(s1);
}
epVO.setDepart(depart);
// dept对象
Dept dept = new Dept();
dept = deptService.getDeptById(ep.getDeptid());
epVO.setDept(dept);
}
public String save() {
Long deptid = epVO.getDept().getDeptid();
try {
Depart depart = epVO.getDepart();
depart.setDeptID(deptid);
departService.insertDepart(depart);
super.printMsg(this.getRequest(), "保存成功!");
cleanObject();
} catch (Exception e) {
super.printErrors(this.getRequest(), e, className);
return RETURN_ERROR;
}
return list();
}
jap页面
<script language="JavaScript" type="text/JavaScript">
//保存
function save() {
var obj = document.getElementById("tableform");
obj.action = '<s:property value="#request.saveUrl"/>';
var submitbtn = document.getElementById("submitbtn");
submitbtn.click();//通过js时间控制提交事件
}
//展示
function query(){
window.location.href='<s:url value="/listEp.action"/>';
}
//加载日期控件
$(document).ready(function(){
addFormValidator();
$("#sendTime").attr("readonly","readonly");
$("#sendTime").click(function(){WdatePicker({isShowClear:false,dateFmt:'yyyy-MM-dd HH:mm:ss'});});
});
</script>
上篇文章给大家介绍了 Java正则表达式匹配,替换,查找,切割的方法 ,接下来,...
4月11日20:30~22:00通过腾讯会议进行了第二次在线学习讨论我把学习笔记整理一下...
项目中用到的一些特殊字符和图标 html代码 XML/HTML Code 复制内容到剪贴板 div ...
DELETEFROMTablesWHEREIDNOTIN(SELECTMin(ID)FROMTablesGROUPBYName) Min的话保...
正则忽略大小写 – RegexOptions.IgnoreCase 例如: 复制代码 代码如下: Str = R...
Elasticsearch 是通过 Lucene 的倒排索引技术实现比关系型数据库更快的过滤。特...
本文实例讲述了Laravel框架源码解析之反射的使用。分享给大家供大家参考,具体如...
工具:Eclipse,Oracle,smartupload.jar;语言:jsp,Java;数据存储:Oracle。...
复制代码 代码如下: % URL="http://news.163.com/special/00011K6L/rss_newstop....
错误描述: 在开发.net项目中,通过microsoft.ACE.oledb读取excel文件信息时,报...