📄 routefilesupload.jsp
字号:
<%
pageContext.setAttribute("encodeFlag" , "false");
String root = ConfigParaLoader.getParameter("rootUrl");
if( request.getParameter("type") !=null && request.getParameter("type").equals("1") ) //上传文件
{
attachURL += SubPathGenerater.getSeperator() + SubPathGenerater.getSubPath( root + SubPathGenerater.getSeperator() + attachURL);
routeValueBean = ( RouteValueBean )session.getAttribute( "routeValueBean" );
//上传文件
// Initialization
mySmartUpload.initialize( pageContext );
System.out.println(" the attachmentsize===" + ConfigParaLoader.getParameter("attachmentSize") );
mySmartUpload.setTotalMaxFileSize( Integer.parseInt( ConfigParaLoader.getParameter("attachmentSize") ) );
// Upload
mySmartUpload.upload();
mySmartUpload.save( root + SubPathGenerater.getSeperator() + attachURL );
//保存已有信息
if( mySmartUpload.getRequest().getParameter("routeName") != null )
routeValueBean.setRouteName( mySmartUpload.getRequest().getParameter("routeName") );
if( mySmartUpload.getRequest().getParameter("description") != null )
routeValueBean.setDescription( mySmartUpload.getRequest().getParameter("description") );
if( mySmartUpload.getRequest().getParameterValues("stepNos") != null )
routeValueBean.setStepNos( mySmartUpload.getRequest().getParameterValues("stepNos") );
if( mySmartUpload.getRequest().getParameter("workflowTypeId") != null )
routeValueBean.setWorkflowTypeId( Integer.parseInt ( mySmartUpload.getRequest().getParameter("workflowTypeId") ) );
Collection c = routeValueBean.getRouteFiles();
for(int i=0;i<mySmartUpload.getFiles().getCount();i++)
{
com.vnex.intranet.upload.File myFile = mySmartUpload.getFiles().getFile(i);
if (!myFile.isMissing())
{
WorkflowFileValueBean wf = new WorkflowFileValueBean();
wf.setName( myFile.getFileName() );
wf.setTitle( attachURL + "/" + myFile.getFileName() );
wf.setDescription( myFile.getFileName() );
c.add(wf);
}
}
routeValueBean.setRouteFiles(c);
session.setAttribute( "routeValueBean", routeValueBean );
}
if( request.getParameter("type") !=null && request.getParameter("type").equals("2") ) //删除文件
{
routeValueBean = ( RouteValueBean )session.getAttribute( "routeValueBean" );
//保存已有信息
routeValueBean.setRouteName( request.getParameter("routeName") );
routeValueBean.setDescription( request.getParameter("description") );
routeValueBean.setWorkflowTypeId(Integer.parseInt( request.getParameter("workflowTypeId") ));
routeValueBean.setStepNos( request.getParameterValues("stepNos"));
String files[] = request.getParameterValues("attachments");
if(files!= null)
{
for(int i = 0; i<files.length; i++)
{
SubPathGenerater.deleteFile( root + SubPathGenerater.getSeperator() + files[i] );
routeValueBean.removeFile( files[i] );
System.out.println("......routeFilesUpload.jsp: remove ok: the file size==="+routeValueBean.getRouteFiles().size());
}
}
session.setAttribute( "routeValueBean", routeValueBean );
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -