Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
barry cho
DWSurvey
Commits
9afca391
Commit
9afca391
authored
4 years ago
by
keyuan
Browse files
Options
Download
Email Patches
Plain Diff
解决读取site配置环境通用问题
parent
9e5e95ae
master
Vue_SpringBoot
master_springBootJsp
master_struts2
v5.2.5
v5.2.2
v5.2.1
v5.2.0
v5.1.0
v4.0.0
v3.5.0
v3.3.0
v3.2.0
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/com/key/dwsurvey/action/sysuser/SysPropertyAction.java
+13
-22
...va/com/key/dwsurvey/action/sysuser/SysPropertyAction.java
with
13 additions
and
22 deletions
+13
-22
src/main/java/com/key/dwsurvey/action/sysuser/SysPropertyAction.java
+
13
-
22
View file @
9afca391
package
com.key.dwsurvey.action.sysuser
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.io.OutputStreamWriter
;
import
java.io.*
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Properties
;
...
...
@@ -42,19 +37,15 @@ import com.opensymphony.xwork2.ActionSupport;
@Result
(
name
=
CrudActionSupport
.
SUCCESS
,
location
=
"/sy/system/sys-property!input.action"
,
type
=
Struts2Utils
.
REDIRECT
)
})
public
class
SysPropertyAction
extends
ActionSupport
{
@Override
public
String
input
()
throws
Exception
{
HttpServletRequest
request
=
Struts2Utils
.
getRequest
();
String
fileName
=
"site.properties"
;
ServletContext
sc
=
Struts2Utils
.
getSession
().
getServletContext
();
String
filePath
=
"/WEB-INF/classes/conf/site/"
.
replace
(
"/"
,
File
.
separator
);
String
fileRealPath
=
sc
.
getRealPath
(
"/"
)+
filePath
+
fileName
;
File
file
=
new
File
(
fileRealPath
);
InputStreamReader
fr
=
new
InputStreamReader
(
new
FileInputStream
(
file
),
"UTF-8"
);
Properties
p
=
new
Properties
();
ClassLoader
cl
=
this
.
getClass
().
getClassLoader
();
InputStream
input
=
cl
.
getResourceAsStream
(
"conf/site/"
.
replace
(
"/"
,
File
.
separator
)+
fileName
);
InputStreamReader
fr
=
new
InputStreamReader
(
input
,
"UTF-8"
);
Properties
p
=
new
Properties
();
try
{
p
.
load
(
fr
);
fr
.
close
();
...
...
@@ -77,7 +68,7 @@ public class SysPropertyAction extends ActionSupport{
}
return
INPUT
;
}
public
String
save
()
throws
Exception
{
//管理员邮箱
String
adminEmail
=
Struts2Utils
.
getParameter
(
"adminEmail"
);
...
...
@@ -105,7 +96,7 @@ public class SysPropertyAction extends ActionSupport{
String
headerData
=
"<a href=\"${ctx }\"><img alt=\"\" src=\"${ctx }/images/logo/LOGO.png\" align=\"middle\" height=\"46\" ><span class=\"titleTempSpan\">OSS</span></a> "
;
String
headerDataPath
=
"/WEB-INF/page/layouts/logo-img.jsp"
.
replace
(
"/"
,
File
.
separator
);
writeData
(
headerDataPath
,
headerData
);
if
(
adminTelephone
!=
null
&&
adminEmail
!=
null
){
//写footer文件
String
footer1
=
"<div class=\"dw_footcopy\" style=\"font-size: 16px;color: gray;\"><p style=\"margin-bottom: 6px;\">"
...
...
@@ -113,22 +104,22 @@ public class SysPropertyAction extends ActionSupport{
+
"<a href=\"/\" style=\"color: gray;font-size: 16px;\">"
+
icpCode
+
"</a></p></div>"
;
String
footerPath
=
"/WEB-INF/page/layouts/footer-1.jsp"
.
replace
(
"/"
,
File
.
separator
);
writeData
(
footerPath
,
footer1
);
String
adminInfo
=
"<div style=\"color: gray;\"><h3 style=\"line-height: 40px;\">联系信息</h3><p style=\"line-height: 40px;\">邮箱:"
+
adminEmail
+
"</p><p style=\"line-height: 40px;\">电话:"
+
adminTelephone
+
"</p><p style=\"line-height: 40px;\">"
+
icpCode
+
"</p></div>"
;
String
adminInfoPath
=
"/WEB-INF/page/layouts/admin-info.jsp"
.
replace
(
"/"
,
File
.
separator
);
writeData
(
adminInfoPath
,
adminInfo
);
}
if
(
loginBgImg
!=
null
){
String
loginbgimg
=
"<div class=\"m-logbg\"><img src=\"${ctx }"
+
loginBgImg
+
"\" style=\"margin-top:0px; margin-left: 0px; opacity: 1;\" width=\"100%\" ></div>"
;
String
loginbgimgPath
=
"/WEB-INF/page/layouts/loginbgimg.jsp"
.
replace
(
"/"
,
File
.
separator
);
writeData
(
loginbgimgPath
,
loginbgimg
);
}
return
SUCCESS
;
}
private
void
writeData
(
String
filePath
,
String
data
)
{
OutputStreamWriter
fw
=
null
;
try
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help