forked from Fireply/Enter
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
423 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
body { | ||
padding-top: 70px; | ||
} | ||
|
||
.enter-btn-detail { | ||
width: 60%; | ||
margin-top: 20%; | ||
margin-left: 20% | ||
} | ||
|
||
.enter-center-vertical { | ||
position: relative; | ||
transform: translateY(40%); | ||
} | ||
|
||
.enter-scrollable { | ||
max-height: 200px; | ||
overflow-y: scroll; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> | ||
<% | ||
String path = request.getContextPath(); | ||
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; | ||
%> | ||
<!DOCTYPE html> | ||
<html lang="zh-CN"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0"> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
<title>Insert title here</title> | ||
<base href="<%=basePath %>" /> | ||
<link rel="icon" href="favicon.ico"> | ||
<link href="css/bootstrap.min.css" rel="stylesheet"> | ||
|
||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> | ||
<!--[if lt IE 9]> | ||
<script src="js/html5shiv.min.js"></script> | ||
<script src="js/respond.min.js"></script> | ||
<![endif]--> | ||
</head> | ||
|
||
<body> | ||
|
||
<jsp:include page="/navbar.jsp" /> | ||
|
||
<div class="container"> | ||
<div class="jumbotron"> | ||
<h1>加入我们吧</h1> | ||
<p>成为我们的代理商,在 VR 元年</p> | ||
<p><a class="btn btn-primary btn-lg" href="#" role="button">联系我们</a></p> | ||
</div> | ||
</div> | ||
|
||
|
||
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> | ||
<script src="js/ie10-viewport-bug-workaround.js"></script> | ||
|
||
<script src="js/jquery.min.js"></script> | ||
<script src="js/bootstrap.min.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> | ||
<%@ taglib uri="/struts-tags" prefix="s" %> | ||
<% | ||
String path = request.getContextPath(); | ||
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; | ||
%> | ||
<!DOCTYPE html> | ||
<html lang="zh-CN"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0"> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
<title>新闻动态</title> | ||
<base href="<%=basePath %>" /> | ||
<link rel="icon" href="favicon.ico"> | ||
<link href="css/bootstrap.min.css" rel="stylesheet"> | ||
|
||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> | ||
<!--[if lt IE 9]> | ||
<script src="js/html5shiv.min.js"></script> | ||
<script src="js/respond.min.js"></script> | ||
<![endif]--> | ||
</head> | ||
|
||
<body> | ||
|
||
<jsp:include page="/navbar.jsp" /> | ||
|
||
<div class="container"> | ||
|
||
新闻 id: ${newsId }<br><br> | ||
新闻标题 EL: ${news.title }<br><br> | ||
新闻内容 EL: ${news.content }<br><br> | ||
|
||
</div><!-- /.container --> | ||
|
||
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> | ||
<script src="js/ie10-viewport-bug-workaround.js"></script> | ||
|
||
<script src="js/jquery.min.js"></script> | ||
<script src="js/bootstrap.min.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> | ||
<%@ taglib uri="/struts-tags" prefix="s" %> | ||
<% | ||
String path = request.getContextPath(); | ||
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; | ||
%> | ||
<!DOCTYPE html> | ||
<html lang="zh-CN"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0"> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
<title>Insert title here</title> | ||
<base href="<%=basePath %>" /> | ||
<link rel="icon" href="favicon.ico"> | ||
<link href="css/bootstrap.min.css" rel="stylesheet"> | ||
|
||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> | ||
<!--[if lt IE 9]> | ||
<script src="js/html5shiv.min.js"></script> | ||
<script src="js/respond.min.js"></script> | ||
<![endif]--> | ||
</head> | ||
|
||
<body> | ||
|
||
<jsp:include page="/navbar.jsp" /> | ||
|
||
<div class="container"> | ||
|
||
<div class="page-header"> | ||
<h1>新闻动态</h1> | ||
</div> | ||
|
||
<s:iterator value="newsList" var="news"> | ||
|
||
<div class="panel panel-default"> | ||
<div class="panel-heading"> | ||
<h3><a href="news!detail?newsId=${news.id }">${news.title }</a></h3> | ||
</div> | ||
<div class="panel-body enter-scrollable"> | ||
<div><s:property value="#news.content" /></div> | ||
</div> | ||
</div> | ||
|
||
</s:iterator> | ||
|
||
</div><!-- /.container --> | ||
|
||
<style> | ||
.enter-scrollable { | ||
max-height: 200px; | ||
overflow-y: scroll; | ||
} | ||
</style> | ||
|
||
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> | ||
<script src="js/ie10-viewport-bug-workaround.js"></script> | ||
|
||
<script src="js/jquery.min.js"></script> | ||
<script src="js/bootstrap.min.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package org.fireply.enter.action; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import org.apache.struts2.interceptor.RequestAware; | ||
import org.apache.struts2.interceptor.SessionAware; | ||
import org.fireply.enter.model.News; | ||
import org.fireply.enter.service.NewsService; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.stereotype.Controller; | ||
|
||
import com.opensymphony.xwork2.ActionSupport; | ||
|
||
@Controller | ||
public class NewsAction extends ActionSupport implements RequestAware, SessionAware { | ||
|
||
@Autowired | ||
@Qualifier("newsServiceImpl") | ||
private NewsService newsService; | ||
|
||
private Map<String, Object> request; | ||
private Map<String, Object> session; | ||
|
||
private List<News> newsList; // 请求新闻列表时将数据库查询结果存放在 newsList | ||
private String newsId; // 请求新闻详情时传递过来的 id | ||
private News news; // 请求新闻详情时将数据库查询结果存放在 news | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(NewsAction.class); | ||
|
||
@Override | ||
public String execute() throws Exception { | ||
newsList = newsService.getAllNews(); | ||
|
||
if (newsList == null || newsList.size() <= 0) { | ||
logger.warn("从数据库查询不到任意一条新闻"); | ||
return ERROR; | ||
} else { | ||
logger.debug("从数据库查询新闻列表成功"); | ||
return "news"; | ||
} | ||
} | ||
|
||
public String detail() throws Exception { | ||
news = newsService.getNews(newsId); | ||
if (news == null) { | ||
logger.warn("从数据库查询 id={} 的新闻失败", newsId); | ||
return ERROR; | ||
} else { | ||
logger.debug("从数据库查询到了 id={} 的新闻", newsId); | ||
return "news-detail"; | ||
} | ||
} | ||
|
||
@Override | ||
public void setRequest(Map<String, Object> request) { | ||
this.request = request; | ||
} | ||
|
||
@Override | ||
public void setSession(Map<String, Object> session) { | ||
this.session = session; | ||
} | ||
|
||
public List<News> getNewsList() { | ||
return newsList; | ||
} | ||
|
||
public void setNewsList(List<News> newsList) { | ||
this.newsList = newsList; | ||
} | ||
|
||
public String getNewsId() { | ||
return newsId; | ||
} | ||
|
||
public void setNewsId(String newsId) { | ||
this.newsId = newsId; | ||
} | ||
|
||
public News getNews() { | ||
return news; | ||
} | ||
|
||
public void setNews(News news) { | ||
this.news = news; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.