Created
June 24, 2014 01:44
-
-
Save luowei/92e587327abc53d02d9d to your computer and use it in GitHub Desktop.
Index页面服务端跳转
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
<%@ page contentType="text/html;charset=UTF-8" language="java" %> | |
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> | |
<%--${pageContext.request.serverName}--%> | |
<%--${header['Host']}--%> | |
<%--<jsp:forward page="index.do" />--%> | |
<c:if test="${header['Host'] eq 'gujia.xxxxx.net' || pageContext.request.serverName eq 'gujia.xxxxx.net' }"> | |
<jsp:forward page="index.do"/> | |
</c:if> | |
<c:if test="${header['Host'] eq 'poll.xxxxx.net' || pageContext.request.serverName eq 'poll.xxxxx.net' }"> | |
<jsp:forward page="home.do"/> | |
</c:if> | |
<%--<% response.sendRedirect("index.do");%>--%> |
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
package com.xxxxx.controller; | |
import com.xxxxx.domain.News; | |
import com.xxxxx.domain.VProductPrice; | |
import com.xxxxx.service.NewsService; | |
import com.xxxxx.service.ProductPriceService; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.stereotype.Controller; | |
import org.springframework.ui.Model; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
import java.util.List; | |
import static org.apache.commons.lang3.StringUtils.isBlank; | |
/** | |
* Created with IntelliJ IDEA. | |
* User: luowei | |
* Date: 13-2-4 | |
* Time: 下午5:05 | |
* To change this template use File | Settings | File Templates. | |
*/ | |
@Controller | |
public class IndexController { | |
@Autowired | |
ProductPriceService productPriceService; | |
@Autowired | |
NewsService newsService; | |
// @RequestMapping(value = "/index",headers = "Host=gujia.xxxxx.net") | |
@RequestMapping(value = "/index") | |
public String index(Model model) { | |
List<VProductPrice> marqueeList = productPriceService.marqueeList(); | |
Boolean noshowModel = true; | |
for (VProductPrice vProductPrice : marqueeList) { | |
noshowModel = noshowModel && isBlank(vProductPrice.getModelName()); | |
} | |
News headNews = newsService.getHeadNews(); | |
List<News> newsList = newsService.getListNews(); | |
//去掉有图片的一条 | |
Integer id = headNews.getId(); | |
for (News news : newsList) { | |
if (id != null && id.equals(news)) { | |
newsList.remove(news); | |
} | |
} | |
if (newsList.size() > 5) { | |
newsList = newsList.subList(0, 5); | |
} | |
// List<News> newsList=newsService.getListNewsWithoutId(headNews==null?null:headNews.getId()); | |
// List<VProductPrice> weekUpList = productPriceService.weekTopList(Config.UP); | |
// List<VProductPrice> weekDownList = productPriceService.weekTopList(Config.DOWN); | |
model.addAttribute("marqueeList", marqueeList) | |
.addAttribute("noshowModel", noshowModel) | |
// .addAttribute("weekUpList",weekUpList) | |
// .addAttribute("weekDownList",weekDownList) | |
.addAttribute("headNews", headNews) | |
.addAttribute("newsList", newsList); | |
return "indexcontent"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment