[@cms_guestbook_list]标签详细介绍

标签介绍

参数:
siteId: 站点ID
ctgId: 类别ID,用于调用不同类别
checked: 是否审核后显示。0:不审核; 1:审核; 默认是不审核

作用:留言列表标签,显示用户的留言列表,不分页

具体例子

1
2
3
4
5
6
7
8
9
10
11
12
< div class = "blue_right_top mt5" > < h2 > < a href = "${base}/guestbook.jspx" target = "_blank" >网友留言 < / a > < / h2 > < / div >
< div class = "blue_right_div" style = "height:280px;" >
         < div class = "w96" >
[ @ cms_guestbook_list count = '10' ]
[ #list tag_list as m]
         < dl class = "gb" >
         < dt > < span > [ $ { m . ctg . name ! } ] < / span > $ { m . titleHtml ! } < / dt >
         < dd > $ { m . contentHtml ! } < / dd >
         < / dl >
[ / #list]          
[ / @ cms_guestbook_list ]     
< / div >

标签实现类

CmsGuestbookListDirective.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package com . jeecms . cms . action . directive ;
 
import static com . jeecms . cms . Constants . TPL_STYLE_LIST ;
import static com . jeecms . cms . Constants . TPL_SUFFIX ;
import static com . jeecms . cms . web . FrontUtils . PARAM_STYLE_LIST ;
import static com . jeecms . common . web . Constants . UTF8 ;
import static com . jeecms . common . web . freemarker . DirectiveUtils . OUT_LIST ;
import static freemarker . template . ObjectWrapper . DEFAULT_WRAPPER ;
 
import java . io . IOException ;
import java . util . HashMap ;
import java . util . List ;
import java . util . Map ;
 
import org . apache . commons . lang . StringUtils ;
 
import com . jeecms . cms . action . directive . abs . AbstractCmsGuestbookDirective ;
import com . jeecms . cms . entity . assist . CmsGuestbook ;
import com . jeecms . cms . entity . main . CmsSite ;
import com . jeecms . cms . web . FrontUtils ;
import com . jeecms . common . web . freemarker . DirectiveUtils ;
import com . jeecms . common . web . freemarker . ParamsRequiredException ;
import com . jeecms . common . web . freemarker . DirectiveUtils . InvokeType ;
 
import freemarker . core . Environment ;
import freemarker . template . TemplateDirectiveBody ;
import freemarker . template . TemplateException ;
import freemarker . template . TemplateModel ;
 
/**
* 评论列表标签
*/
public class CmsGuestbookListDirective extends AbstractCmsGuestbookDirective {
     /**
     * 模板名称
     */
     public static final String TPL_NAME = "guestbook_list" ;
 
     /**
     * 输入参数,内容ID。
     */
     public static final String PARAM_SITE_ID = "siteId" ;
 
     @ SuppressWarnings ( "unchecked" )
     public void execute ( Environment env , Map params , TemplateModel [ ] loopVars ,
             TemplateDirectiveBody body ) throws TemplateException , IOException {
         CmsSite site = FrontUtils . getSite ( env ) ;
         int first = FrontUtils . getFirst ( params ) ;
         int max = FrontUtils . getCount ( params ) ;
         List < CmsGuestbook > list = cmsGuestbookMng . getList ( getSiteId ( params ) ,
                 getCtgId ( params ) , getRecommend ( params ) , getChecked ( params ) ,
                 getDesc ( params ) , true , first , max ) ;
 
         Map < String , TemplateModel > paramWrap = new HashMap < String , TemplateModel > (
                 params ) ;
         paramWrap . put ( OUT_LIST , DEFAULT_WRAPPER . wrap ( list ) ) ;
         Map < String , TemplateModel > origMap = DirectiveUtils
                 . addParamsToVariable ( env , paramWrap ) ;
         InvokeType type = DirectiveUtils . getInvokeType ( params ) ;
         String listStyle = DirectiveUtils . getString ( PARAM_STYLE_LIST , params ) ;
         if ( InvokeType . sysDefined == type ) {
             if ( StringUtils . isBlank ( listStyle ) ) {
                 throw new ParamsRequiredException ( PARAM_STYLE_LIST ) ;
             }
             env . include ( TPL_STYLE_LIST + listStyle + TPL_SUFFIX , UTF8 , true ) ;
         } else if ( InvokeType . userDefined == type ) {
             if ( StringUtils . isBlank ( listStyle ) ) {
                 throw new ParamsRequiredException ( PARAM_STYLE_LIST ) ;
             }
             FrontUtils . includeTpl ( TPL_STYLE_LIST , site , env ) ;
         } else if ( InvokeType . custom == type ) {
             FrontUtils . includeTpl ( TPL_NAME , site , params , env ) ;
         } else if ( InvokeType . body == type ) {
             body . render ( env . getOut ( ) ) ;
         } else {
             throw new RuntimeException ( "invoke type not handled: " + type ) ;
         }
         DirectiveUtils . removeParamsFromVariable ( env , paramWrap , origMap ) ;
     }
}

转载于:https://my.oschina.net/u/2006682/blog/311794

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
介绍 dll名 fanz3.asp data/db.mdb database/db.mdb db.mdb ftbbs.asp editor editor/admin_login.asp editor/db/editor.mdb editor/db/eWebEditor.mdb editor/db/editor.asp editor/db/eWebEditor.asp eWebEditor/db/editor.asp eWebEditor/db/eWebEditor.asp sqlin.asp news_more.asp database/PowerEasy2006.mdb database/Powereasy5.mdb flash/downfile.asp database/SiteWeaver6.5.mdb imagebig_honor.asp Databases/0791idc.mdb admin.asp ad_login.asp ad_manage.asp add_admin.asp addmember.asp adduser.asp adm_login.asp admin/admin.asp admin/admin_login.asp admin/index.asp admin/login.asp admin/manage.asp admin_admin.asp admin_del.asp admin_delete.asp admin_edit.asp admin_index.asp Admin_Login.asp admin_main.asp admin_pass.asp admin_user.asp admin.asp adminadduser.asp admindel.asp admindelete.asp adminedit.asp adminlogin.asp adminmember.asp admintab.asp adminuser.asp adminuserlogin.asp amd/index.asp amd/login.asp amd/super.asp amd_/admin.asp amd_/index.asp amd_/login.asp amd_/super.asp art.asp article.asp backup.asp bbs/Databackup/dvbbs.MDB bbs/down_addsoft.asp bbs/login.asp bbs/post_upfile.asp bbs/post_upfile.asp bbs/post_upload.asp bbs/post_upload.asp bbs/reg_upload.asp bbs/reg_upload.asp bbs/saveup.asp bbs/saveup.asp bbs/upfile.asp bbs/upfile.asp bbs/upload_soft.asp chkadmin.asp chklogin.asp config.asp conn.asp count.asp count/supervise/Login.asp count_admin.asp database.asp databases.asp db.asp dbase.asp default_admin.asp default_login.asp del.asp del_admin.asp delete.asp denglu.asp devel.asp down/login.asp down_addsoft.asp dvbbs/down_addsoft.asp dvbbs/post_upfile.asp dvbbs/post_upfile.asp dvbbs/post_upload.asp dvbbs/post_upload.asp dvbbs/reg_upload.asp dvbbs/reg_upload.asp dvbbs/saveup.asp dvbbs/saveup.asp dvbbs/upfile.asp dvbbs/upfile.asp dvbbs/upload_soft.asp edit.asp editmember.asp edituser.asp emyuser_login.asp exit.asp file.asp files.asp findaccount.asp forum.asp freeweb_admin.asp girl.asp girls.asp guanli.asp houtai.asp houtaiguanli.asp Hradmin/admin.asp htdocs.asp htgl.asp idea.asp idea
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值