Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
BudgetManagementSystem
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王利雷
BudgetManagementSystem
Commits
d6679a63
Commit
d6679a63
authored
May 19, 2019
by
shj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下载功能在url里接收参数,在历史预算页面提供下载
parent
97b2d07a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
1 deletion
+54
-1
BudgetHandler.java
src/main/java/handlers/BudgetHandler.java
+24
-0
history.jsp
src/main/webapp/history.jsp
+6
-1
test.jsp
src/main/webapp/test.jsp
+24
-0
No files found.
src/main/java/handlers/BudgetHandler.java
View file @
d6679a63
...
...
@@ -179,6 +179,30 @@ public class BudgetHandler {
}
}
@RequestMapping
(
"/Download/csv/{budgetid}"
)
public
void
downloadCsv
(
@PathVariable
(
"budgetid"
)
Long
budgetid
,
HttpServletRequest
request
,
HttpServletResponse
response
,
HttpSession
session
)
{
//response.setContentType("application/octet-stream");
response
.
setContentType
(
"text/html;charset=UTF-8"
);
String
sessionID
=
budgetid
.
toString
();
try
{
Budget
budget
=
retrieveBudget
(
sessionID
);
//writer = response.getWriter();
response
.
setHeader
(
"content-disposition"
,
"attachment;filename=Budget"
+
sessionID
+
".csv"
);
assert
budget
!=
null
;
//budgetToOutputStream(budget, writer);
budgetToOutputStream
(
budget
,
response
.
getOutputStream
());
System
.
out
.
println
(
"Download..............."
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
catch
(
Throwable
e
)
{
e
.
printStackTrace
();
}
}
@RequestMapping
(
"/Detail"
)
public
ModelAndView
budgetDetailHandler
(
HttpServletRequest
request
)
{
String
sessionID
=
getSessionID
(
request
.
getCookies
());
...
...
src/main/webapp/history.jsp
View file @
d6679a63
...
...
@@ -83,7 +83,12 @@
<button
class=
"btn btn-success"
>
查看详情
</button>
</a>
<button
class=
"btn btn-info"
>
修改属性
</button>
<button
class=
"btn btn-info"
>
下载说明文件
</button>
<a
v-bind:href=
"'${pageContext.request.contextPath}/Budget/Download/csv/'+budget.id"
>
<button
class=
"btn btn-success"
>
下载csv
</button>
</a>
<a
v-bind:href=
"'${pageContext.request.contextPath}/Budget/Download/word/'+budget.id"
>
<button
class=
"btn btn-success"
>
下载word
</button>
</a>
<button
class=
"btn btn-danger"
@
click=
"del(budget.id)"
>
删除
</button>
</td>
</tr>
...
...
src/main/webapp/test.jsp
View file @
d6679a63
...
...
@@ -56,6 +56,7 @@
</div>
</div>
</nav>
<
%
--
<
button
class=
"btn btn-success"
onclick=
jsp()
>
test
</button>
<label
id=
"xxx"
>
123445
</label>
...
...
@@ -91,6 +92,29 @@ ${pageContext.request.contextPath}<br>
</tr>
</table>
</div>
--%>
<div>
<div
id=
"menu"
>
控制
</div>
<div
id=
"show"
>
展示
</div>
</div>
<script
type=
"text/javascript"
>
var
list
=
$
(
"#show"
);
var
menu
=
document
.
getElementById
(
"menu"
);
list
.
hide
();
menu
.
onmouseover
=
function
(
ev
)
{
list
.
show
();
};
menu
.
onmouseleave
=
function
(
ev
)
{
list
.
hide
();
};
</script>
<div
id=
"VueTest"
>
<select
v-model=
"num"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment