package top.wull.blog.action; import javax.annotation.Resource; import org.apache.struts2.ServletActionContext; import org.hibernate.criterion.DetachedCriteria; import org.hibernate.criterion.Restrictions; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; import com.opensymphony.xwork2.ActionContext; import top.wull.blog.antity.Essay; import top.wull.blog.antity.EssayType; import top.wull.blog.service.EssayTypeService; import top.wull.blog.util.PageBean; @Controller("EssayTypeAction") @Scope("prototype") public class EssayTypeAction extends EssayAction{ @Resource(name="essayTypeService") EssayTypeService ets ; private Integer currentPage = 1; private Integer pageSize = 6; public Integer getCurrentPage() { return currentPage; } public void setCurrentPage(Integer currentPage) { this.currentPage = currentPage; } /** * 根据分类查询 */ public String select() throws Exception{ String url = ServletActionContext.getRequest().getRequestURI();// /blog/life/ddd //url = url.substring(17, url.length()); String [] urls = url.split("select"); url = urls[1]; System.out.println("url" + url); //第一步根据url查询Essaytype的id EssayType et = ets.getEssayTypeByName(url); //第二步根据et查询本类型的Essay //方法写好了,但是弃用 //List<Essay> elist = es.getEssayByEssayType(et); DetachedCriteria dc = DetachedCriteria.forClass(Essay.class); dc.add(Restrictions.eq("essayType", et)); PageBean pb = es.getPageBean(dc,currentPage,pageSize); //pb.setList(elist); ActionContext.getContext().put("pageBean", pb); url = "/select"+url; //传到页面,公用life.jsp的changeapge。不用多写一个 file.jsp ActionContext.getContext().put("changeurl", url); System.out.println("currentPage======="+currentPage); ActionContext.getContext().put("newEssaylist", newEssaylist(8)); ActionContext.getContext().put("showMaxCountEssay", showMaxCountEssay()); System.out.println("url" + urls[0]); if(urls[0].equals("/blog/knowledge/")){ ActionContext.getContext().put("EssayType", getEssayType(1)); }else{ ActionContext.getContext().put("EssayType", getEssayType(2)); } return "show"; } }

and123456 LV11
2022年3月16日
wjh12345654321 LV14
2022年1月20日
864152530 LV5
2021年6月7日
iws2000 LV11
2021年5月20日
myzczx LV25
2021年4月9日
李海洋 LV12
2020年12月24日
lstudents LV1
2020年8月20日
wllwll LV4
2020年7月19日
kuluohua LV15
2020年6月14日
1224649005 LV6
2020年6月5日

krispeng LV14
2024年11月20日
abandan LV4
2023年11月6日
zhaobing_g LV3
2023年8月28日
tangyongheng08 LV6
2023年7月24日
getset LV8
2023年5月18日
acid6161
2023年4月21日
暂无贡献等级
lyhlyh LV10
2023年2月24日
微信网友_6328951600910336
2023年1月31日
暂无贡献等级
yohohero LV1
2023年1月14日
zxc131313 LV12
2022年12月9日