上面的登录是个图片,当点击的时候变成手的样式
<
tr
>
<
td
height
=
"25"
><
div
align
=
"center"
style
="
cursor
:
hand
"
onclick
=
"func_login()"
><
img
src
=
"
${basePath}
/images/dl.gif"
width
=
"57"
height
=
"20"
></
div
>
</
td
>
</
tr
>
<
script
type
=
"text/javascript"
>
if
(parent != window){
parent.location.href = window.location.href;
}
function
func_login(){
document.forms[0].submit();
}
</
script
>
<
td
width
=
"211"
background
=
"
${basePath}
/images/login_10.gif"
>
</
td
>
-------------------------------------登录界面--------------------------------------------------------------------------------
<%@
page
language
=
"java"
contentType
=
"text/html; charset=UTF-8"
pageEncoding
=
"UTF-8"
%>
<%@
taglib
uri
=
"/struts-tags"
prefix
=
"s"
%>
<
html
>
<
head
>
<
title
>
登录页面
</
title
>
<%@
include
file
=
"/js/commons.jspf"
%>
<%-- <link href="${basePath}/css/public.css" rel="stylesheet" type="text/css" /> --%>
<
script
type
=
"text/javascript"
>
if
(parent != window){
parent.location.href = window.location.href;
}
function
func_login(){
document.forms[0].submit();
}
</
script
>
</
head
>
<
body
style
="
text-align
:
center
;"
>
<
form
action
=
"loginAction_login.action"
method
=
"post"
>
<
table
width
=
"100%"
height
=
"100%"
border
=
"0"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
bgcolor
=
"#1075b1"
>
</
td
>
</
tr
>
<
tr
>
<
td
height
=
"608"
background
=
"
${basePath}
/images/login_03.gif"
><
table
width
=
"847"
border
=
"0"
align
=
"center"
cellpadding
=
"0"
cellspacing
=
"0"
>
<
tr
>
<
td
height
=
"318"
background
=
"
${basePath}
/images/login_04.gif"
>
</
td
>
</
tr
>
<
tr
>
<
td
height
=
"84"
><
table
width
=
"100%"
border
=
"0"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
width
=
"381"
height
=
"84"
background
=
"
${basePath}
/images/login_06.gif"
>
</
td
>
<
td
width
=
"200"
valign
=
"middle"
background
=
"
${basePath}
/images/login_07.gif"
><
table
width
=
"100%"
border
=
"0"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
width
=
"55"
height
=
"24"
valign
=
"bottom"
><
div
align
=
"right"
><
span
class
=
"STYLE3"
>
用户名
</
span
></
div
></
td
>
<
td
width
=
"10"
valign
=
"bottom"
>
</
td
>
<
td
height
=
"24"
colspan
=
"2"
valign
=
"bottom"
>
<
select
name
=
"name"
>
<
option
value
=
"范冰冰"
>
范冰冰
</
option
>
<
option
value
=
"冯小刚"
>
冯小刚
</
option
>
<
option
value
=
"范冰冰经纪人"
>
范冰冰经纪人
</
option
>
<
option
value
=
"冯小刚经纪人"
>
冯小刚经纪人
</
option
>
<
option
value
=
"王中军"
>
王中军
</
option
>
</
select
><
br
/>
</
td
>
</
tr
>
<
tr
></
tr
>
</
table
></
td
>
<
td
width
=
"26"
><
img
src
=
"
${basePath}
/images/login_08.gif"
width
=
"26"
height
=
"84"
></
td
>
<
td
width
=
"67"
background
=
"
${basePath}
/images/login_09.gif"
>
<
table
width
=
"100%"
border
=
"0"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
height
=
"25"
><
div
align
=
"center"
style
="
cursor
:
hand
"
onclick
=
"func_login()"
><
img
src
=
"
${basePath}
/images/dl.gif"
width
=
"57"
height
=
"20"
></
div
></
td
>
</
tr
>
</
table
>
</
td
>
<
td
width
=
"211"
background
=
"
${basePath}
/images/login_10.gif"
>
</
td
>
</
tr
>
</
table
></
td
>
</
tr
>
<
tr
>
<
td
height
=
"206"
background
=
"
${basePath}
/images/login_11.gif"
>
</
td
>
</
tr
>
</
table
></
td
>
</
tr
>
<
tr
>
<
td
bgcolor
=
"#152753"
>
</
td
>
</
tr
>
</
table
>
</
form
>
<
script
type
=
"text/javascript"
>
document.getElementById(
"username"
).focus();
</
script
>
</
body
>
</
html
>
登录之后转到main.jsp代码如下
上面方框中找到LoginAction对应的方法然后根据struts.xml文件跳转到对应的jsp文件
对应上面的top.jsp文件
<%@
page
language
=
"java"
contentType
=
"text/html; charset=UTF-8"
pageEncoding
=
"UTF-8"
%>
<%@
taglib
prefix
=
"s"
uri
=
"/struts-tags"
%>
<
html
>
<
head
>
<%@
include
file
=
"/js/commons.jspf"
%>
<
style
type
=
"text/css"
>
<!--
body
{
margin-left
:
0px
;
margin-top
:
0px
;
margin-right
:
0px
;
margin-bottom
:
0px
;
}
.STYLE1
{
font-size
:
12px
;
color
:
#000000
;
}
.STYLE5
{
font-size
:
12
}
.STYLE7
{
font-size
:
12px
;
color
:
#FFFFFF
; }
-->
</
style
>
<
meta
http-equiv
=
"Content-Type"
content
=
"text/html; charset=UTF-8"
>
<
title
>
banner
</
title
>
</
head
>
<
body
>
<
table
width
=
"100%"
border
=
"0"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
height
=
"57"
background
=
"
${pageContext.request.contextPath }
/images/main_03.gif"
><
table
width
=
"100%"
border
=
"0"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
width
=
"450"
height
=
"57"
background
=
"
${pageContext.request.contextPath }
/images/main_01.gif"
>
</
td
>
<
td
>
</
td
>
<
td
width
=
"281"
valign
=
"bottom"
><
table
width
=
"100%"
border
=
"0"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
width
=
"33"
height
=
"27"
><
img
src
=
"
${pageContext.request.contextPath }
/images/main_05.gif"
width
=
"33"
height
=
"27"
/></
td
>
<
td
width
=
"448"
background
=
"
${pageContext.request.contextPath }
/images/main_06.gif"
><
table
width
=
"425"
border
=
"0"
align
=
"center"
cellpadding
=
"0"
cellspacing
=
"0"
>
<
tr
>
<
td
><
div
align
=
"right"
><
span
class
=
"STYLE6"
><
b
>
当前登录用户:${sessionScope.globle_user.name }
</
b
></
span
></
div
></
td
>
<
td
><
div
align
=
"right"
><
a
href
=
"loginAction_logout.action"
target
=
"parent"
><
img
src
=
"
${pageContext.request.contextPath }
/images/quit.gif"
width
=
"69"
height
=
"17"
/></
a
></
div
></
td
>
</
tr
>
</
table
></
td
>
</
tr
>
</
table
></
td
>
</
tr
>
</
table
></
td
>
</
tr
>
<
tr
>
<
td
height
=
"40"
background
=
"
${pageContext.request.contextPath }
/images/main_10.gif"
><
table
width
=
"100%"
border
=
"0"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
width
=
"194"
height
=
"40"
background
=
"
${pageContext.request.contextPath }
/images/main_07.gif"
>
</
td
>
<
td
><
table
width
=
"100%"
border
=
"0"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
width
=
"21"
><
img
src
=
"
${pageContext.request.contextPath }
/images/main_13.gif"
width
=
"19"
height
=
"14"
/></
td
>
<
td
width
=
"300"
class
=
"STYLE7"
>
</
td
>
<
td
>
</
td
>
</
tr
>
</
table
></
td
>
<
td
width
=
"260"
background
=
"
${pageContext.request.contextPath }
/images/main_11.gif"
><
table
width
=
"100%"
border
=
"0"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
width
=
"16%"
><
span
class
=
"STYLE5"
></
span
></
td
>
<
td
width
=
"84%"
><
div
align
=
"center"
><
span
class
=
"STYLE7"
>
<
div
id
=
"test"
></
div
>
<
script
>
setInterval(
"document.getElementById('test').innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());"
,100);
</
script
>
</
span
></
div
></
td
>
</
tr
>
</
table
></
td
>
</
tr
>
</
table
></
td
>
</
tr
>
</
table
>
</
body
>
</
html
>
---------------------------------------------------------------------------------------------------------
文件上传,需要指定的三个类型
自定义拦截器
--------------------------------------------------------------------
文件上传
<
td
>
<
div
align
=
"left"
class
=
"STYLE21"
>
流程名称:
<
s:textfield
name
=
"filename"
cssStyle
=
"width: 200px;"
/><
br
/>
流程文件:
<
s:file
name
=
"file"
cssStyle
=
"width: 200px;"
/><
br
/>
<
input
type
=
"submit"
value
=
"上传流程"
class
=
"button_ok"
/>
</
div
>
</
td
>
部署流程定义对应的service
/**请假申请Dao*/
private
ILeaveBillDao
leaveBillDao
;
private
RepositoryService
repositoryService
;
private
RuntimeService
runtimeService
;
private
TaskService
taskService
;
private
FormService
formService
;
private
HistoryService
historyService
;
/**部署流程定义*/
@Override
public
void
saveNewDeploye(File
file
, String
filename
) {
try
{
//2:将File类型的文件转化成ZipInputStream流
ZipInputStream
zipInputStream
=
new
ZipInputStream(
new
FileInputStream(
file
));
repositoryService
.createDeployment()
//创建部署对象
.name(
filename
)
//添加部署名称
.addZipInputStream(
zipInputStream
)
//
.deploy();
//完成部署
}
catch
(Exception
e
) {
e
.printStackTrace();
}
}
-------------------------------------------------------------------------------------
分析问题
<%@
page
language
=
"java"
contentType
=
"text/html; charset=UTF-8"
pageEncoding
=
"UTF-8"
%>
<%@
include
file
=
"/js/commons.jspf"
%>
<%@
taglib
uri
=
"/struts-tags"
prefix
=
"s"
%>
<
html
>
<
head
>
<
meta
http-equiv
=
"Content-Type"
content
=
"text/html; charset=UTF-8"
>
<
title
>
部署管理
</
title
>
</
head
>
<
body
>
<
table
width
=
"100%"
border
=
"0"
align
=
"center"
cellpadding
=
"0"
cellspacing
=
"0"
>
<
tr
>
<
td
height
=
"30"
><
table
width
=
"100%"
border
=
"0"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
height
=
"24"
bgcolor
=
"#353c44"
><
table
width
=
"100%"
border
=
"0"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
><
table
width
=
"100%"
border
=
"0"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
width
=
"6%"
height
=
"19"
valign
=
"bottom"
><
div
align
=
"center"
><
img
src
=
"
${pageContext.request.contextPath }
/images/tb.gif"
width
=
"14"
height
=
"14"
/></
div
></
td
>
<
td
width
=
"94%"
valign
=
"bottom"
><
span
class
=
"STYLE1"
>
部署信息管理列表
</
span
></
td
>
</
tr
>
</
table
></
td
>
<
td
><
div
align
=
"right"
><
span
class
=
"STYLE1"
>
</
span
></
div
></
td
>
</
tr
>
</
table
></
td
>
</
tr
>
</
table
></
td
>
</
tr
>
<
tr
>
<
td
><
table
width
=
"100%"
border
=
"0"
cellpadding
=
"0"
cellspacing
=
"1"
bgcolor
=
"#a8c7ce"
onmouseover
=
"changeto()"
onmouseout
=
"changeback()"
>
<
tr
>
<
td
width
=
"10%"
height
=
"20"
bgcolor
=
"d3eaef"
class
=
"STYLE6"
><
div
align
=
"center"
><
span
class
=
"STYLE10"
>
ID
</
span
></
div
></
td
>
<
td
width
=
"60%"
height
=
"20"
bgcolor
=
"d3eaef"
class
=
"STYLE6"
><
div
align
=
"center"
><
span
class
=
"STYLE10"
>
流程名称
</
span
></
div
></
td
>
<
td
width
=
"20%"
height
=
"20"
bgcolor
=
"d3eaef"
class
=
"STYLE6"
><
div
align
=
"center"
><
span
class
=
"STYLE10"
>
发布时间
</
span
></
div
></
td
>
<
td
width
=
"10%"
height
=
"20"
bgcolor
=
"d3eaef"
class
=
"STYLE6"
><
div
align
=
"center"
><
span
class
=
"STYLE10"
>
操作
</
span
></
div
></
td
>
</
tr
>
<
s:if
test
=
"#depList!=null && #depList.size()>0"
>
<
s:iterator
value
=
"#depList"
>
<
tr
>
<
td
height
=
"20"
bgcolor
=
"#FFFFFF"
class
=
"STYLE6"
><
div
align
=
"center"
><
s:property
value
=
"id"
/></
div
></
td
>
<
td
height
=
"20"
bgcolor
=
"#FFFFFF"
class
=
"STYLE19"
><
div
align
=
"center"
><
s:property
value
=
"name"
/></
div
></
td
>
<
td
height
=
"20"
bgcolor
=
"#FFFFFF"
class
=
"STYLE19"
><
div
align
=
"center"
><
s:date
name
=
"deploymentTime"
format
=
"yyyy-MM-dd HH:mm:ss"
/></
div
></
td
>
<
td
height
=
"20"
bgcolor
=
"#FFFFFF"
><
div
align
=
"center"
class
=
"STYLE21"
>
<
a
href
=
"workflowAction_delDeployment.action?deploymentId=
<
s:property
value
=
"id"
/>
"
>
删除
</
a
>
</
div
></
td
>
</
tr
>
</
s:iterator
>
</
s:if
>
</
table
></
td
>
</
tr
>
</
table
>
<
hr
>
<
br
/>
<
table
width
=
"100%"
border
=
"0"
align
=
"center"
cellpadding
=
"0"
cellspacing
=
"0"
>
<
tr
>
<
td
height
=
"30"
><
table
width
=
"100%"
border
=
"0"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
height
=
"24"
bgcolor
=
"#353c44"
><
table
width
=
"100%"
border
=
"0"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
><
table
width
=
"100%"
border
=
"0"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
width
=
"6%"
height
=
"19"
valign
=
"bottom"
><
div
align
=
"center"
><
img
src
=
"
${pageContext.request.contextPath }
/images/tb.gif"
width
=
"14"
height
=
"14"
/></
div
></
td
>
<
td
width
=
"94%"
valign
=
"bottom"
><
span
class
=
"STYLE1"
>
流程定义信息列表
</
span
></
td
>
</
tr
>
</
table
></
td
>
<
td
><
div
align
=
"right"
><
span
class
=
"STYLE1"
>
</
span
></
div
></
td
>
</
tr
>
</
table
></
td
>
</
tr
>
</
table
></
td
>
</
tr
>
<
tr
>
<
td
><
table
width
=
"100%"
border
=
"0"
cellpadding
=
"0"
cellspacing
=
"1"
bgcolor
=
"#a8c7ce"
onmouseover
=
"changeto()"
onmouseout
=
"changeback()"
>
<
tr
>
<
td
width
=
"12%"
height
=
"20"
bgcolor
=
"d3eaef"
class
=
"STYLE6"
><
div
align
=
"center"
><
span
class
=
"STYLE10"
>
ID
</
span
></
div
></
td
>
<
td
width
=
"18%"
height
=
"20"
bgcolor
=
"d3eaef"
class
=
"STYLE6"
><
div
align
=
"center"
><
span
class
=
"STYLE10"
>
名称
</
span
></
div
></
td
>
<
td
width
=
"10%"
height
=
"20"
bgcolor
=
"d3eaef"
class
=
"STYLE6"
><
div
align
=
"center"
><
span
class
=
"STYLE10"
>
流程定义的KEY
</
span
></
div
></
td
>
<
td
width
=
"10%"
height
=
"20"
bgcolor
=
"d3eaef"
class
=
"STYLE6"
><
div
align
=
"center"
><
span
class
=
"STYLE10"
>
流程定义的版本
</
span
></
div
></
td
>
<
td
width
=
"15%"
height
=
"20"
bgcolor
=
"d3eaef"
class
=
"STYLE6"
><
div
align
=
"center"
><
span
class
=
"STYLE10"
>
流程定义的规则文件名称
</
span
></
div
></
td
>
<
td
width
=
"15%"
height
=
"20"
bgcolor
=
"d3eaef"
class
=
"STYLE6"
><
div
align
=
"center"
><
span
class
=
"STYLE10"
>
流程定义的规则图片名称
</
span
></
div
></
td
>
<
td
width
=
"10%"
height
=
"20"
bgcolor
=
"d3eaef"
class
=
"STYLE6"
><
div
align
=
"center"
><
span
class
=
"STYLE10"
>
部署ID
</
span
></
div
></
td
>
<
td
width
=
"10%"
height
=
"20"
bgcolor
=
"d3eaef"
class
=
"STYLE6"
><
div
align
=
"center"
><
span
class
=
"STYLE10"
>
操作
</
span
></
div
></
td
>
</
tr
>
<
s:if
test
=
"#pdList!=null && #pdList.size()>0"
>
<
s:iterator
value
=
"#pdList"
>
<
tr
>
<
td
height
=
"20"
bgcolor
=
"#FFFFFF"
class
=
"STYLE6"
><
div
align
=
"center"
><
s:property
value
=
"id"
/></
div
></
td
>
<
td
height
=
"20"
bgcolor
=
"#FFFFFF"
class
=
"STYLE19"
><
div
align
=
"center"
><
s:property
value
=
"name"
/></
div
></
td
>
<
td
height
=
"20"
bgcolor
=
"#FFFFFF"
class
=
"STYLE19"
><
div
align
=
"center"
><
s:property
value
=
"key"
/></
div
></
td
>
<
td
height
=
"20"
bgcolor
=
"#FFFFFF"
class
=
"STYLE6"
><
div
align
=
"center"
><
s:property
value
=
"version"
/></
div
></
td
>
<
td
height
=
"20"
bgcolor
=
"#FFFFFF"
class
=
"STYLE6"
><
div
align
=
"center"
><
s:property
value
=
"resourceName"
/></
div
></
td
>
<
td
height
=
"20"
bgcolor
=
"#FFFFFF"
class
=
"STYLE6"
><
div
align
=
"center"
><
s:property
value
=
"diagramResourceName"
/></
div
></
td
>
<
td
height
=
"20"
bgcolor
=
"#FFFFFF"
class
=
"STYLE6"
><
div
align
=
"center"
><
s:property
value
=
"deploymentId"
/></
div
></
td
>
<
td
height
=
"20"
bgcolor
=
"#FFFFFF"
><
div
align
=
"center"
class
=
"STYLE21"
>
<
a
target
=
"_blank"
href
=
"workflowAction_viewImage.action?deploymentId=
<
s:property
value
=
"deploymentId"
/>
&imageName=
<
s:property
value
=
"diagramResourceName"
/>
"
>
查看流程图
</
a
>
</
div
></
td
>
</
tr
>
</
s:iterator
>
</
s:if
>
</
table
></
td
>
</
tr
>
</
table
>
<
hr
>
<
br
/>
<!-- 发布流程 -->
<
form
action
=
"workflowAction_newdeploy.action"
enctype
=
"multipart/form-data"
method
=
"POST"
>
<
table
width
=
"100%"
border
=
"0"
align
=
"center"
cellpadding
=
"0"
cellspacing
=
"0"
>
<
tr
>
<
td
height
=
"30"
><
table
width
=
"100%"
border
=
"0"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
height
=
"24"
bgcolor
=
"#353c44"
><
table
width
=
"100%"
border
=
"0"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
><
table
width
=
"100%"
border
=
"0"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
width
=
"6%"
height
=
"19"
valign
=
"bottom"
><
div
align
=
"center"
><
img
src
=
"
${pageContext.request.contextPath }
/images/tb.gif"
width
=
"14"
height
=
"14"
/></
div
></
td
>
<
td
width
=
"94%"
valign
=
"bottom"
><
span
class
=
"STYLE1"
>
部署流程定义
</
span
></
td
>
</
tr
>
</
table
></
td
>
<
td
><
div
align
=
"right"
><
span
class
=
"STYLE1"
>
</
span
></
div
></
td
>
</
tr
>
</
table
></
td
>
</
tr
>
</
table
></
td
>
</
tr
>
<
tr
>
<
td
>
<
div
align
=
"left"
class
=
"STYLE21"
>
流程名称:
<
s:textfield
name
=
"filename"
cssStyle
=
"width: 200px;"
/><
br
/>
流程文件:
<
s:file
name
=
"file"
cssStyle
=
"width: 200px;"
/><
br
/>
<
input
type
=
"submit"
value
=
"上传流程"
class
=
"button_ok"
/>
</
div
>
</
td
>
</
tr
>
</
table
>
</
form
>
</
body
>
</
html
>
点击上传流程按钮会提交到
<
form
action
=
"workflowAction_newdeploy.action">对应的action,出现上面的现象
/**
* 发布流程
*
@return
*/
public
String newdeploy(){
//获取页面传递的值
//1:获取页面上传递的zip格式的文件,格式是File类型
File
file
=
workflowBean
.getFile();
//文件名称
String
filename
=
workflowBean
.getFilename();
//完成部署
workflowService
.saveNewDeploye(
file
,
filename
);
return
"list"
;
}
根据struts.xml找到list
<
action
name
=
"workflowAction_*"
class
=
"workflowAction"
method
=
"{1}"
>
<
result
name
=
"list"
type
=
"redirectAction"
>//重定向到另一个action的名字找到
deployHome对应的页面然后对
depList进行遍历就能在上面进行显示了
<
param
name
=
"actionName"
>
workflowAction_deployHome.action
</
param
>
</
result
>
<
result
name
=
"deployHome"
>
WEB-INF/views/workflow/workflow.jsp
</
result
>
<
result
name
=
"task"
>
WEB-INF/views/workflow/task.jsp
</
result
>
<
result
name
=
"image"
>
WEB-INF/views/workflow/image.jsp
</
result
>
<
result
name
=
"listTask"
type
=
"redirectAction"
>
<
param
name
=
"actionName"
>
workflowAction_listTask.action
</
param
>
</
result
>
<
result
name
=
"viewTaskForm"
type
=
"redirectAction"
>
<!-- 从LeaveBill.bpmn文件中获取任务节点的url连接 -->
<
param
name
=
"actionName"
>
/${#url}
</
param
>
</
result
>
<
result
name
=
"taskForm"
>
WEB-INF/views/workflow/taskForm.jsp
</
result
>
<
result
name
=
"viewHisComment"
>
WEB-INF/views/workflow/taskFormHis.jsp
</
result
>
</
action
>
-----------------------------------------------------------
/**
* 部署管理首页显示
*
@return
*/
public
String deployHome(){
//1:查询部署对象信息,对应表(act_re_deployment)
List<Deployment>
depList
=
workflowService
.findDeploymentList();
//2:查询流程定义的信息,对应表(act_re_procdef)
List<ProcessDefinition>
pdList
=
workflowService
.findProcessDefinitionList();
//放置到上下文对象中
ValueContext. putValueContext(
"depList"
,
depList
);
ValueContext. putValueContext(
"pdList"
,
pdList
);
return
"deployHome"
;
}
----------------------------------------------------------
/**部署流程定义*/
@Override
public
void
saveNewDeploye(File
file
, String
filename
) {
try
{
//2:将File类型的文件转化成ZipInputStream流
ZipInputStream
zipInputStream
=
new
ZipInputStream(
new
FileInputStream(
file
));
repositoryService
.createDeployment()
//创建部署对象
.name(
filename
)
//添加部署名称
.addZipInputStream(
zipInputStream
)
//
.deploy();
//完成部署
}
catch
(Exception
e
) {
e
.printStackTrace();
}
}
点解查看
按钮
<
a
target
=
"_blank"
href
=
"workflowAction_viewImage.action?deploymentId=
<
s:property
value
=
"deploymentId"
/>
&imageName=
<
s:property
value
=
"diagramResourceName"
/>
"
>
查看流程图
</
a
>
_blank会在新窗口开辟一个png文件,
diagramResourceName是哪个png文件的名称
会携带两个参数
deploymentId和
imageName到
WorkflowAction对应的viewImage这个方法
/**
* 查看流程图
*
@throws
Exception
*/
public
String viewImage()
throws
Exception{
//1:获取页面传递的部署对象ID和资源图片名称
//部署对象ID
String
deploymentId
=
workflowBean
.getDeploymentId();
//资源图片名称
String
imageName
=
workflowBean
.getImageName();
//2:获取资源文件表(act_ge_bytearray)中资源图片输入流InputStream
InputStream
in
=
workflowService
.findImageInputStream(
deploymentId
,
imageName
);
//3:从response对象获取输出流
OutputStream
out
= ServletActionContext.getResponse().getOutputStream();
//4:将输入流中的数据读取出来,写到输出流中
for
(
int
b
=-1;(
b
=
in
.read())!=-1;){
out
.write(
b
);
}
out
.close();
in
.close();
//将图写到页面上,用输出流写
return
null
;
}
WorkflowService类中的
findImageInputStream()方法
/**使用部署对象ID和资源图片名称,获取图片的输入流*/
@Override
public
InputStream findImageInputStream(String
deploymentId
,
String
imageName
) {
return
repositoryService
.getResourceAsStream(
deploymentId
,
imageName
);
}
点击删除按钮
<
a
href
=
"workflowAction_delDeployment.action?deploymentId=
<
s:property
value
=
"id"
/>
"
>
删除
</
a
>
找到对应的
workflowAction_delDeployment方法,携带流程对应部署id值 deploymentId
/**
* 删除部署信息
*/
public
String delDeployment(){
//1:获取部署对象ID
String
deploymentId
=
workflowBean
.getDeploymentId();
//2:使用部署对象ID,删除流程定义
workflowService
.deleteProcessDefinitionByDeploymentId(
deploymentId
);
return
"list"
;
}
上面删除成功之后根据struts.xml文件重定向到
workflowAction_deployHome.action对应
deployHome方法然后根据这个方法携带数据跳转到
/**
* 部署管理首页显示
*
@return
*/
public
String deployHome(){
//1:查询部署对象信息,对应表(act_re_deployment)
List<Deployment>
depList
=
workflowService
.findDeploymentList();
//2:查询流程定义的信息,对应表(act_re_procdef)
List<ProcessDefinition>
pdList
=
workflowService
.findProcessDefinitionList();
//放置到上下文对象中
ValueContext. putValueContext(
"depList"
,
depList
);
ValueContext. putValueContext(
"pdList"
,
pdList
);
return
"deployHome"
;
}
deployHome.jsp文件再进行遍历显示
<
action
name
=
"workflowAction_*"
class
=
"workflowAction"
method
=
"{1}"
>
<
result
name
=
"list"
type
=
"redirectAction"
>
<
param
name
=
"actionName"
>
workflowAction_deployHome.action
</
param
>
</
result
>
<action>
//删除流程定义的方法
/**使用部署对象ID,删除流程定义*/
@Override
public
void
deleteProcessDefinitionByDeploymentId(String
deploymentId
) {
repositoryService
.deleteDeployment(
deploymentId
,
true
);
}
<
a
onclick
=
"return confirm('确定要删除本记录吗?')"
href
=
"workflowAction_delDeployment.action?deploymentId=
${id }
"
>
删除
</
a
>
< a onclick ="return confirm('确定要删除'+ ${id}+'这条记录吗?')" href="workflowAction_delDeployment.action?deploymentId=${id } ">删除 </a>
<
a
href
=
"leaveBillAction_home.action"
target
=
"main"
>
请假管理
</
a
>
main就是在左边点击在右边进行显示
-----------------------------------------------------------
<%@ page language="java" pageEncoding="UTF-8" %>
<html xmlns= "http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> 菜单</title >
<%@ include file="/js/commons.jspf" %>
<script language= "JavaScript" type ="text/JavaScript">
//判断浏览器的变量
NS4 = (document.layers) ? 1 : 0;
IE4 = (document.all) ? 1 : 0;
ver4 = (NS4 || IE4) ? 1 : 0;
//定义各个层的位置及显示状态
if (ver4) {
with (document) {
write( "<STYLE TYPE='text/css'>" );
if (NS4) {
write( ".parent {position:absolute; visibility:visible}");
write( ".child {position:absolute; visibility:visible}");
write( ".regular {position:absolute; visibility:visible}")
}
else {
write( ".child {display:none}")
}
write( "</STYLE>");
}
}
//当菜单打开时,页面上菜单以下的东西的位置顺序往下推,菜单合起时,菜单以下的东西自动上移。
function arrange() {
nextY = document.layers[firstInd].pageY +document.layers[firstInd].document.height;
for (i=firstInd+1; i<document.layers.length; i++) {
whichele = document.layers[i];
if (whichele.visibility != "hide" ) {
whichele.pageY = nextY;
nextY += whichele.document.height;
}
}
}
//初始化菜单
function initIt(){
divColl = document.getElementsByTagName( "DIV");
for (i=0; i<divColl.length; i++) {
whichele = divColl(i);
if (whichele.className == "child" ) whichele.style.display = "none" ;
}
}
//展开菜单的方法
function expandIt(ele) {
var layernum = 2;
var childname = ele.substring(0,4);
var childnum = ele.substring(4,5)
whichele = document.getElementById(ele + "Child");
if (whichele.style.display == "none") {
whichele.style.display = "";
for (i=1;i<layernum+1;i++)
{ if (childnum != i)
{ document.getElementById(childname + i +"Child").style.display ="none" ;
}
}
}
else {
//whichele.style.display = "none";
}
}
onload = initIt;
</script>
<style type= "text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.STYLE3 {
font-size: 12px;
color: #435255;
}
.STYLE4 {font-size : 12px}
.STYLE5 {font-size : 12px; font-weight: bold; }
a {text-decoration :none;color:black}
-->
</style></ head>
<body>
<table width= "147" height ="100%" border="0" align="center" cellpadding= "0" cellspacing ="0">
<tr >
<td height="23" background="images/main_34.gif" ><div align="center" class="STYLE4" id= "Menu1Parent"><table width="100%" border="0" cellspacing="0" cellpadding= "0">
<tr >
<td width= "9%"> </td>
<td width= "83%"><div align="center" class="STYLE4" ><a href= "#" onClick ="expandIt('Menu1'); return false" >业务管理 </a></ div></td >
<td width= "8%"> </td>
</tr >
</table ></div></ td>
</tr >
<tr >
<td valign="top">< div align ="center" id= "Menu1Child">
<table width="82%" border= "0" align ="center" cellpadding="0" cellspacing= "0">
<tr>
<td height= "38"><table width="100%" border= "0" cellspacing="0" cellpadding= "0">
<tr>
<td width= "33" height ="28">< img src="images/main_52.gif" width="28" height= "28"></td >
<td width= "99"><table width="100%" border="0" cellspacing= "0" cellpadding ="0">
<tr>
<td height= "23" class ="STYLE4" style="cursor :hand" onMouseOver="this.style.backgroundImage='url(images/tab_bg.gif)';this.style.borderStyle='solid';this.style.borderWidth='1';borderColor='#adb9c2'; "onmouseout="this.style.backgroundImage='url()';this.style.borderStyle='none'" >
<a href="leaveBillAction_home.action" target="main"> 请假管理</a >
</td>
</tr>
</table></ td>
</tr>
</table></ td>
</tr>
</table >
</div ></td>
</tr >
<tr >
<td height="23" background="images/main_34_1.gif" ><div align= "center" class="STYLE4" id="Menu2Parent">< table width ="100%" border="0" cellspacing= "0" cellpadding ="0">
<tr >
<td width= "9%"> </td>
<td width= "83%"><div align="center" class="STYLE4" ><a href= "#" onClick ="expandIt('Menu2'); return false" >流程管理 </a></ div></td >
<td width= "8%"> </td>
</tr >
</table ></div></ td>
</tr >
<tr >
<td valign="top">< div align ="center" id= "Menu2Child" style="display :none">
<table width="82%" border= "0" align ="center" cellpadding="0" cellspacing= "0">
<tr>
<td height= "38"><table width="100%" border= "0" cellspacing="0" cellpadding= "0">
<tr>
<td width= "33" height ="28">< img src="images/main_48.gif" width="28" height= "28"></td >
<td width= "99"><table width="100%" border="0" cellspacing= "0" cellpadding ="0">
<tr>
<td height= "23" class ="STYLE4" style="cursor :hand" onMouseOver="this.style.backgroundImage='url(images/tab_bg.gif)';this.style.borderStyle='solid';this.style.borderWidth='1';borderColor='#adb9c2'; "onmouseout="this.style.backgroundImage='url()';this.style.borderStyle='none'" >
<a href="workflowAction_deployHome.action" target="main"> 部署管理</a >
</td>
</tr>
</table></ td>
</tr>
</table></ td>
</tr>
<tr>
<td height= "38"><table width="100%" border= "0" cellspacing="0" cellpadding= "0">
<tr>
<td width= "33" height ="28">< img src="images/main_40.gif" width="28" height= "28"></td >
<td width= "99"><table width="100%" border="0" cellspacing= "0" cellpadding ="0">
<tr>
<td height= "23" class ="STYLE4" style="cursor :hand" onMouseOver="this.style.backgroundImage='url(images/tab_bg.gif)';this.style.borderStyle='solid';this.style.borderWidth='1';borderColor='#adb9c2'; "onmouseout="this.style.backgroundImage='url()';this.style.borderStyle='none'" >
<a href="workflowAction_listTask.action" target="main"> 任务管理</a >
</td>
</tr>
</table></ td>
</tr>
</table></ td>
</tr>
</table ></div>
</td >
</tr >
<tr >
<td height="19" background="images/main_69.gif" ><table width= "100%" border="0" cellspacing= "0" cellpadding ="0">
<tr >
<td width= "1%"> </td>
<td width= "99%" valign ="bottom">< span class="STYLE3" >刘洋(QQ:506069708) </span></ td>
</tr >
</table ></td>
</tr >
</table>
</body>
</html>
< td height ="20" bgcolor ="#FFFFFF" class ="STYLE19"><div align="center">< s:date name ="leaveDate" format ="yyyy-MM-dd HH:mm:ss"/></div ></td>
<
div
align
=
"left"
class
=
"STYLE21"
>
<
s:hidden
name
=
"id"
></
s:hidden
>
<!-- 表单id值 -->
<
s:hidden
name
=
"user.id"
></
s:hidden
>
<!-- 请假人id值 -->
请假天数:
<
s:textfield
name
=
"days"
cssStyle
=
"width: 200px;"
/><
br
/>
请假原因:
<
s:textfield
name
=
"content"
cssStyle
=
"width: 800px;"
/><
br
/>
备
  
注:
<
s:textarea
name
=
"remark"
cols
=
"50"
rows
=
"5"
/><
br
/>
<
input
type
=
"submit"
value
=
"提交"
/>
</
div
>
不加上上面的<s:hidden name="user.id"></s:hidden>上面数据库中的user_id的值不会显示
备  注显示效果:
等同于