IndexNews.java~61~
资源名称:shihua.rar [点击查看]
上传用户:zghglow
上传日期:2022-08-09
资源大小:27227k
文件大小:7k
源码类别:
WEB源码(ASP,PHP,...)
开发平台:
JavaScript
- package com.chinacannel.xlchemical.Tag;
- import java.util.*;
- import javax.servlet.jsp.*;
- import javax.servlet.jsp.tagext.*;
- import com.chinacannel.entity.*;
- import com.chinacannel.xlchemical.service.*;
- import java.text.SimpleDateFormat;
- public class IndexNews extends TagSupport {
- private Long menuID = new Long(0);
- private String webPath = "";
- public int doStartTag() throws JspException {
- try {
- MenuService ms = new MenuService();
- InformationService is = new InformationService();
- Information imageInfo = null;
- Menu menu = null;
- ms.beginTran();
- menu = ms.GetMenuById(this.getMenuID());
- String Language = "CN";
- String more = "";
- if (this.pageContext.getSession().getAttribute("Language") != null) {
- Language = this.pageContext.getSession().getAttribute(
- "Language").
- toString();
- }
- if(Language.equals("CN")){
- more = "更多";
- }else{
- more = "";
- }
- if(menu != null){
- imageInfo = is.GetIndexImgInformationByMenu(menu);
- List list = is.GetIndexInformation(menu);
- ms.commit();
- String title = "";
- String time = "";
- String summary = "";
- StringBuilder sb = new StringBuilder();
- sb.append("<table width="287" border="0" cellspacing="0" cellpadding="0">" + "n");
- sb.append("<tr><td><table width="100%" border="0" cellspacing="0" cellpadding="0">" + "n");
- sb.append("<tr><td width="4%"> </td>" + "n");
- sb.append("<td width="96%"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>" + "n");
- sb.append("<td width="84%" class="Title"><img src="images/Index_PD_Title.jpg" width="11" height="9"> " + menu.getMen_Name() + "</td>" + "n");
- sb.append("<td width="16%"><a href="" + this.getWebPath() + "/Index.do?todo=OpenIndexMenu&fMenuID=" + menu.getMen_Superior() + "&cMenuID=" + menu.getMen_ID() + "">更多>></a></td></tr></table></td></tr>" + "n");
- sb.append("<tr><td height="4" bgcolor="FE0000"></td><td height="4" bgcolor="E9E9E9"></td></tr></table></td></tr>" + "n");
- sb.append("<tr><td height="133" valign="top" style="padding-top:;">" + "n");
- sb.append("<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="E9E9E9">" + "n");
- if(imageInfo != null){
- sb.append("<tr><td width="29%" style="padding:5px;"><img src="" + imageInfo.getImage().getPath() + "/" + imageInfo.getImage().getReallyname() + "" width="79" height="62" alt="" /></td>" + "n");
- }else{
- sb.append("<tr><td width="29%" style="padding:5px;"><img src="" width="79" height="62" alt="" /></td>" + "n");
- }
- sb.append("<td width="71%"><table width="100%" border="0" cellspacing="0" cellpadding="0">" + "n");
- if (imageInfo != null) {
- if (imageInfo.getInf_Title().length() > 6) {
- title = imageInfo.getInf_Title().substring(0, 6);
- } else {
- title = imageInfo.getInf_Title();
- }
- title = "<a href='" + this.getWebPath() +
- "/Index.do?todo=OpenInfo&infID=" +
- imageInfo.getInf_ID() + "&type=" +
- imageInfo.getMenu().getMen_Type() + "&fMenuID=" +
- imageInfo.getMenu().getMen_Superior() + "'>" + title +
- "</a>";
- }
- sb.append("<tr><td width="50%"><strong>" + title + "</strong></td>" + "n");
- if (imageInfo != null) {
- time = new SimpleDateFormat("yyyy-MM-dd").format(imageInfo.
- getInf_Time());
- }
- sb.append("<td width="50%" class="Date">[" + time +
- "]</td></tr>" + "n");
- if (imageInfo != null) {
- if (imageInfo.getInf_Summary().length() > 20) {
- summary = imageInfo.getInf_Summary().substring(0, 20);
- } else {
- summary = imageInfo.getInf_Summary();
- }
- }
- sb.append("<tr><td colspan="2">" + summary + "...</td></tr></table></td></tr></table>" + "n");
- sb.append("<table width="100%" border="0" cellspacing="0" cellpadding="0">" + "n");
- for (int i = 0; i < list.size(); i++) {
- Information inf = (Information) list.get(i);
- sb.append("<tr><td width="6%"><img src="images/Ft.jpg" width="8" height="9" alt="" /></td>" + "n");
- String s = "";
- if (inf.getInf_Title().length() > 20) {
- s = inf.getInf_Title().substring(0, 20) + "...";
- } else {
- s = inf.getInf_Title();
- }
- sb.append("<td width="94%"><a href="" + this.getWebPath() +
- "/Index.do?todo=OpenInfo&infID=" + inf.getInf_ID() +
- "&type=" + inf.getMenu().getMen_Type() +
- "&fMenuID=" + inf.getMenu().getMen_Superior() +
- "" class="News_Link">" + s + "</a></td></tr>" +
- "n");
- }
- sb.append("</table><table width="100%" border="0" cellspacing="0" cellpadding="0">" + "n");
- sb.append("<tr><td height="2" bgcolor="E4E4E4"></td></tr></table></td></td></table>" + "n");
- JspWriter out = pageContext.getOut();
- out.print(sb.toString());
- }else{
- JspWriter out = pageContext.getOut();
- out.print("");
- }
- } catch (Exception e) {
- throw new JspException(e);
- }
- return 0;
- }
- public String getWebPath() {
- return webPath;
- }
- public Long getMenuID() {
- return menuID;
- }
- public void setWebPath(String webPath) {
- this.webPath = webPath;
- }
- public void setMenuID(Long menuID) {
- this.menuID = menuID;
- }
- }