📄 outlineaction.java
字号:
OutlineForm outlineForm=(OutlineForm) form;
ActionForward forward=mapping.findForward("input");
OutlineDTO outlineDTO =new OutlineDTO();
ArrayList list1=null;
try {
BeanUtils.copyProperties(outlineDTO, outlineForm);
service.setDataSource(this.getDataSource(request,"mydatasource"));
list1=(ArrayList) service.load(outlineDTO);
if(list1.size()!=0&&list1!=null){
request.setAttribute("list1",list1);
forward = mapping.findForward("load");
}
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (AppException e) {
e.printStackTrace();
}
return forward;
}
/**
* 根据id修改大纲信息
* @param mapping 响应转发请求
* @param form OutlineForm对象
* @param request 请求响应
* @param response 响应结果
* @return forward 响应成功跳转到query方法,查询修改后的新信息。
* @author 陈忠
* Creation date:04-30-2008
*/
public ActionForward update(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response){
OutlineForm outlineForm=(OutlineForm) form;
ActionForward forward=mapping.findForward("input");
OutlineDTO outlineDTO =new OutlineDTO();
boolean flag=false;
try {
BeanUtils.copyProperties(outlineDTO, outlineForm);
outlineDTO.filer();
service.setDataSource(this.getDataSource(request,"mydatasource"));
service.modify(outlineDTO);
flag=true;
if(flag){
forward=mapping.findForward("outlinelist");
}
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (AppException e) {
e.printStackTrace();
}
return forward;
}
/**
* 在数据字典中提取课程
* @param mapping 响应转发请求
* @param form OutlineForm对象
* @param request 请求响应
* @param response 响应结果
* @return null 无返回
* @author 陈忠
* Creation date:04-30-2008
*/
public ActionForward findobjectname(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response){
OutlineForm outlineForm=(OutlineForm) form;
ActionForward forward=mapping.findForward("input");
DictionaryDTO dto=new DictionaryDTO();
ArrayList list=null;
Object[] objs=null;
try {
dto.setRowPerPage("10000");
dto.setCurrentPage("1");
dto.setScope("9");
service.setDataSource(this.getDataSource(request,"mydatasource"));
objs=(Object[])service.list(dto);
list=(ArrayList)objs[0];
if(list.size()!=0){
request.setAttribute("listname",list);
}
}catch (AppException e) {
e.printStackTrace();
}
return null;
}
/**
* 在数据字典中提取课程类型
* @param mapping 响应转发请求
* @param form OutlineForm对象
* @param request 请求响应
* @param response 响应结果
* @return null 无返回
* @author 陈忠
* Creation date:04-30-2008
*/
public ActionForward findobjecttype(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response){
OutlineForm outlineForm=(OutlineForm) form;
ActionForward forward=mapping.findForward("input");
DictionaryDTO dto=new DictionaryDTO();
ArrayList list=null;
Object[] objs=null;
try {
dto.setRowPerPage("10000");
dto.setCurrentPage("1");
dto.setPid("173");
service.setDataSource(this.getDataSource(request,"mydatasource"));
objs=(Object[])service.list(dto);
list=(ArrayList)objs[0];
if(list.size()!=0){
request.setAttribute("listtype",list);
}
}catch (AppException e) {
e.printStackTrace();
}
return null;
}
/**
* 检查大纲编号的唯一性
* @param mapping 响应转发请求
* @param form OutlineForm对象
* @param request 请求响应
* @param response 响应结果
* @return null 无返回
* @author 陈忠
* Creation date:04-30-2008
*/
public ActionForward check(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws IllegalAccessException, InvocationTargetException, IOException {
OutlineForm outlineForm = (OutlineForm) form;
ActionForward forward=mapping.getInputForward();
String no=request.getParameter("objectNo");
response.setContentType("text/html");
String responseContext="true";
PrintWriter out=response.getWriter();
Object[] obj=null;
try {
OutlineDTO outlineDTO=new OutlineDTO();
BeanUtils.copyProperties(outlineDTO, outlineForm);
outlineDTO.setCurrentPage("1");
outlineDTO.setRowPerPage("10000");
service.setDataSource(getDataSource(request,"mydatasource"));
obj=(Object[])service.findAll(outlineDTO);
ArrayList list=(ArrayList)obj[1];
if(list.size()!=0&&list!=null){
for(Iterator it = list.iterator();it.hasNext();){
OutlineVO outlineVO=(OutlineVO)it.next();
if(no.equals(outlineVO.getObjectNo())){
responseContext="false";
}
}
} if(no==null||no.equals("")){
responseContext="null";
}
out.println(responseContext);
out.flush();
out.close();
}catch (AppException e) {
e.printStackTrace();
}
return null;
}
/**
* 获得大纲编号
* @param mapping 响应转发请求
* @param form OutlineForm对象
* @param request 请求响应
* @param response 响应结果
* @return null
* @author 陈忠
* Creation date:04-30-2008
* @throws AppException 应用异常
*/
public ActionForward findobjectno(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws AppException{
OutlineForm outlineForm=(OutlineForm) form;
ActionForward forward=mapping.findForward("input");
OutlineDTO outlineDTO =new OutlineDTO();
Object[] obj=null;
ArrayList list=null;
String currentPage=request.getParameter("currentPage");
String type=request.getParameter("type");
try {
BeanUtils.copyProperties(outlineDTO, outlineForm);
PaginationVO paginationVO = new PaginationVO();
if(type==null||type.equals("")||type.equals("0")){
currentPage="1";
}else if(type.equals("1")){
currentPage=String.valueOf(Integer.parseInt(outlineDTO.getCurrentPage())-1);
}else if(type.equals("2")){
currentPage=String.valueOf(Integer.parseInt(outlineDTO.getCurrentPage())+1);
}else if(type.equals("3")){
currentPage=(String)request.getParameter("allpage");
}
paginationVO.setCurrentPage(Integer.parseInt(currentPage));
outlineDTO.setCurrentPage(String.valueOf(paginationVO.getCurrentPage()));
outlineDTO.setRowPerPage("10000");
service.setDataSource(this.getDataSource(request,"mydatasource"));
obj=(Object[]) service.findAll(outlineDTO);
int count=((Integer)obj[0]).intValue();
paginationVO.setResultsNumber(count);
paginationVO.setRowsPerPage(8);
paginationVO.setAllPages((count/paginationVO.getRowsPerPage())+(count%paginationVO.getRowsPerPage())>0?1:0);
list=(ArrayList)obj[1];
if(list.size()!=0&&list!=null){
request.setAttribute("list4", list);
forward =mapping.findForward("queryoutline");
request.setAttribute("outlineDTO", outlineDTO);
request.setAttribute("paginationVO", paginationVO);
}else{
forward =mapping.findForward("failingQuery");
}
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
return null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -