jeecms标签使用参数分析

以@cms_friendlink_list 为例对应的类 class="com.marcms.cms.action.directive.CmsFriendlinkListDirective",通过查看类代码分析标签使用时候用到的参数(输入和输出)。

com.jeecms.cms.action.directive包下应该是标签所在的目录。

打开WEB-INF/config目录下的jeecms-context.xml配置文件,可以看到有如下bean的配置

<!--标签-->
	<bean id="cms_pagination" class="com.marcms.cms.action.directive.PaginationDirective"/>
	<bean id="cms_channel_list" class="com.marcms.cms.action.directive.ChannelListDirective"/>
	<bean id="cms_channel_page" class="com.marcms.cms.action.directive.ChannelPageDirective"/>
	<bean id="cms_channel" class="com.marcms.cms.action.directive.ChannelDirective"/>
	<bean id="cms_content" class="com.marcms.cms.action.directive.ContentDirective"/>
	<bean id="cms_content_list" class="com.marcms.cms.action.directive.ContentListDirective"/>
	<bean id="cms_content_page" class="com.marcms.cms.action.directive.ContentPageDirective"/>
	<bean id="cms_tag_list" class="com.marcms.cms.action.directive.ContentTagListDirective"/>
	<bean id="cms_tag_page" class="com.marcms.cms.action.directive.ContentTagPageDirective"/>
	<bean id="cms_topic_list" class="com.marcms.cms.action.directive.CmsTopicListDirective"/>
	<bean id="cms_topic_page" class="com.marcms.cms.action.directive.CmsTopicPageDirective"/>
	<bean id="cms_comment_list" class="com.marcms.cms.action.directive.CmsCommentListDirective"/>
	<bean id="cms_comment_page" class="com.marcms.cms.action.directive.CmsCommentPageDirective"/>
	<bean id="cms_guestbook_ctg_list" class="com.marcms.cms.action.directive.CmsGuestbookCtgListDirective"/>
	<bean id="cms_guestbook_list" class="com.marcms.cms.action.directive.CmsGuestbookListDirective"/>
	<bean id="cms_guestbook_page" class="com.marcms.cms.action.directive.CmsGuestbookPageDirective"/>
	<bean id="cms_vote" class="com.marcms.cms.action.directive.CmsVoteDirective"/>
	<bean id="cms_friendlink_ctg_list" class="com.marcms.cms.action.directive.CmsFriendlinkCtgListDirective"/>
	<bean id="cms_friendlink_list" class="com.marcms.cms.action.directive.CmsFriendlinkListDirective"/>
	<bean id="cms_lucene_list" class="com.marcms.cms.lucene.LuceneDirectiveList"/>
	<bean id="cms_lucene_page" class="com.marcms.cms.lucene.LuceneDirectivePage"/>
	<bean id="cms_advertising" class="com.marcms.cms.action.directive.CmsAdvertisingDirective"/>
	<bean id="cms_vote_list" class="com.marcms.cms.action.directive.CmsVoteListDirective"/>
	<bean id="cms_model" class="com.marcms.cms.action.directive.CmsModelDirective"/>
	<bean id="cms_score_group" class="com.marcms.cms.action.directive.ScoreGroupDirective"/>
	
	<!--后台权限标签-->
	<bean id="cms_perm" class="com.marcms.cms.web.PermistionDirective"/>

这里是bean对应的类,<bean id="cms_friendlink_list" class="com.marcms.cms.action.directive.CmsFriendlinkListDirective"/>为例,打开类文件,看到以下代码

/**
 * 友情链接类别列表标签
 */
public class CmsFriendlinkListDirective implements TemplateDirectiveModel {
	/**
	 * 输入参数,站点ID。
	 */
	public static final String PARAM_SITE_ID = "siteId";
	/**
	 * 输入参数,类别ID。
	 */
	public static final String PARAM_CTG_ID = "ctgId";
	/**
	 * 输入参数,是否显示。
	 */
	public static final String PARAM_ENABLED = "enabled";

其中3个final String对应的就是输入参数(分别是 siteId,ctgId,enabled),这三个输入参数对应的值的范围可以从下列代码中分析得到:

		Integer siteId = getSiteId(params);
		if (siteId == null) {
			siteId = FrontUtils.getSite(env).getId();
		}
		Integer ctgId = getCtgId(params);
		Boolean enabled = getEnabled(params);
		if (enabled == null) {
			enabled = true;
		}
分别对应整型,整型,逻辑类型,以及某些参数的默认值(这些值在使用标签时候可以不写初始值)。

对应输出参数查看以下代码:

		List<CmsFriendlink> list = cmsFriendlinkMng.getList(siteId, ctgId,
				enabled);

		Map<String, TemplateModel> paramWrap = new HashMap<String, TemplateModel>(
				params);
		paramWrap.put(OUT_LIST, DEFAULT_WRAPPER.wrap(list));

其中 paramWrap.put是将输出的数值放入到MAP中(paramWrap.put(OUT_LIST, DEFAULT_WRAPPER.wrap(list))),list存放的就是需要输出的对象(类型是List的CmsFriendlik对象) OUT_LIST 值为 tag_list ,在com.marcms.common.web.freemarker包的类 DirectiveUtils 中声明为 tag_list

	/**
	 * 输出参数:对象数据
	 */
	public static final String OUT_BEAN = "tag_bean";
	/**
	 * 输出参数:列表数据
	 */
	public static final String OUT_LIST = "tag_list";
	/**
	 * 输出参数:分页数据
	 */
	public static final String OUT_PAGINATION = "tag_pagination";
	/**
	 * 参数:是否调用模板。
	 */
	public static final String PARAM_TPL = "tpl";
	/**
	 * 参数:次级模板名称
	 */
	public static final String PARAM_TPL_SUB = "tplSub";

输出的属性名称为tag_list,对应的值是List类型的CmsFriednlink对象.CmsFriendlink extends BaseCmsFriendlink。说明CmsFriendlink (可以理解为entity.assist)是继承 BaseCmsFriendlink类(最终的实体类,它对应属性就是tag_list所对应的属性值)

BaseCmsFriendlink类代码如下:

 * @hibernate.class
 *  table="jc_friendlink"
 */

public abstract class BaseCmsFriendlink  implements Serializable {

	public static String REF = "CmsFriendlink";
	public static String PROP_DOMAIN = "domain";
	public static String PROP_EMAIL = "email";
	public static String PROP_DESCRIPTION = "description";
	public static String PROP_LOGO = "logo";
	public static String PROP_SITE = "site";
	public static String PROP_ENABLED = "enabled";
	public static String PROP_VIEWS = "views";
	public static String PROP_CATEGORY = "category";
	public static String PROP_PRIORITY = "priority";
	public static String PROP_NAME = "name";
	public static String PROP_ID = "id";

这里可以看到输出tag_list中可以访问的字段值,(有setter的可以访问)

再看一下这个标签在html模板中的用法:

[@cms_friendlink_list ctgId='#{id}']
        [#list tag_list as link]
        <div style="margin-left:1.5%; float:left;">
        <a href="${link.domain}" οnclick="$.get('${base}/friendlink_view.jspx?id=${link.id}')" target="_blank">${link.name}</a>
        </div>
        [/#list]
[/@cms_friendlink_list]

ctgId 是输入参数,tag_list是输出参数 类型是list , link代表tag_list中的每个对象 ,这个对象对应的属性值link.domain,link.id,link.name。其中输入通过上面的分析可以有3个,另外2个可以不写有默认值;输出参数有若干个,只用到了3个。

还有几个问题没有找到:

1。@cms_friednlink_list是如何和cms_friednlink_list类联系在一起的???(猜测是通过properties文件联系的)

2。在WEB-INF/config/jeecms/jeecms.properties文件里面有一句 directive.cms_friendlink_list=cms_friendlink_list 不知道什么意思,是不是和将@cms_friednlink_list是如何和cms_friednlink_list类联系在一起??在config/下的jeecms-server-front.xm里面关于(前台)freemaker的配置有以下代码:

	<bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
		<!--获取标签配置-->
		<property name="freemarkerVariables" value="#{propertyUtils.getBeanMap('directive.')}"/>

是不是这个?freemakerconfig还是不熟悉,其中propertyUtils应该是个类从jeecms.properties文件找到directive. cms_friendlink_list对应的cms_friendlink_list 类???

后台关于freemaker的配置有如下代码:

				<entry key="cms_perm" value-ref="cms_perm"/>
				<entry key="text_cut" value-ref="text_cut"/>
				<entry key="html_cut" value-ref="html_cut"/>
				<entry key="cms_content_list" value-ref="cms_content_list"/>
				<entry key="cms_content_page" value-ref="cms_content_page"/>

这里也是标签吗???

3.WEB-INF/directive/link/l_.txt是做什么的???

4。/WEB-INF/ftl/jeecms/index.ftl as p,/WEB-INF/ftl/spring.ftl as s 在哪里使用的???

要解决上面的问题要看freemaker的文档了!!!


版权声明:本文为博主原创文章,未经博主允许不得转载。

  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 扫一扫,分享海报

<p style="margin: 0cm; background: white;"><span style="font-size: 10.5pt; font-family: '微软雅黑',sans-serif; mso-bidi-font-family: Arial; color: black; mso-themecolor: text1;">本课程使用<span lang="EN-US">YOLOv5</span>和<span lang="EN-US">DeepSORT</span>对视频中的行人、车辆做多目标跟踪和计数,开展<span lang="EN-US">YOLOv5</span>目标检测和<span lang="EN-US">DeepSORT</span>多目标跟踪强强联手的应用。</span></p> <p style="margin: 0cm; background: white;"><span lang="EN-US" style="font-size: 10.5pt; font-family: '微软雅黑',sans-serif; mso-bidi-font-family: Arial; color: black; mso-themecolor: text1;"> </span><span style="font-size: 10.5pt; font-family: '微软雅黑',sans-serif; mso-bidi-font-family: Arial; color: black; mso-themecolor: text1;">课程分别在</span><span lang="EN-US"><span style="box-sizing: border-box;">Windows</span>和</span><span lang="EN-US" style="font-family: '微软雅黑',sans-serif; mso-bidi-font-family: Arial; color: black; mso-color-alt: windowtext;">Ubuntu</span><span style="font-size: 10.5pt; font-family: '微软雅黑',sans-serif; mso-bidi-font-family: Arial; color: black; mso-themecolor: text1;">系统上做项目演示,并对<span lang="EN-US">DeepSORT</span>原理和代码做详细解读(使用<span lang="EN-US">PyCharm</span>单步调试讲解)。</span></p> <p style="margin: 0cm; background: white;"><span lang="EN-US" style="font-size: 10.5pt; font-family: 'Arial',sans-serif; color: black; mso-themecolor: text1;"> </span></p> <p style="margin: 0cm; background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"><span style="box-sizing: border-box;"><span style="font-size: 10.5pt; font-family: '微软雅黑',sans-serif; mso-bidi-font-family: Arial; color: black; mso-themecolor: text1;">课程包括:<span style="font-size: 10.5pt; font-family: '微软雅黑',sans-serif; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; color: black; mso-themecolor: text1;">基础篇、实践篇、原理篇和代码解析篇。</span></span></span></p> <p style="text-indent: -21.0pt; mso-list: l0 level1 lfo1; background: white; margin: 0cm 0cm 0cm 21.0pt;"><!-- [if !supportLists]--><span lang="EN-US" style="font-size: 14.0pt; mso-bidi-font-size: 10.5pt; font-family: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings; color: black; mso-themecolor: text1;"><span style="mso-list: Ignore;">Ÿ<span style="font: 7.0pt 'Times New Roman';">  </span></span></span><!--[endif]--><span style="font-size: 10.5pt; font-family: '微软雅黑',sans-serif; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; color: black; mso-themecolor: text1;">基础篇包括多目标跟踪任务介绍、数据集和评估指标;</span></p> <p style="text-indent: -21.0pt; mso-list: l0 level1 lfo1; background: white; margin: 0cm 0cm 0cm 21.0pt;"><!-- [if !supportLists]--><span lang="EN-US" style="font-size: 14.0pt; mso-bidi-font-size: 10.5pt; font-family: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings; color: black; mso-themecolor: text1;"><span style="mso-list: Ignore;">Ÿ<span style="font: 7.0pt 'Times New Roman';">  </span></span></span><!--[endif]--><span style="font-size: 10.5pt; font-family: '微软雅黑',sans-serif; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; color: black; mso-themecolor: text1;">实践篇包括</span><span lang="EN-US" style="font-size: 10.5pt; font-family: '微软雅黑',sans-serif; mso-bidi-font-family: Arial; color: black; mso-themecolor: text1;">Win10</span><span style="font-size: 10.5pt; font-family: '微软雅黑',sans-serif; mso-bidi-font-family: Arial; color: black; mso-themecolor: text1;">和<span lang="EN-US">Ubuntu</span>系统上的<span lang="EN-US">YOLOv5+DeepSORT</span>的多目标跟踪和计数具体的实践操作步骤演示,特别是对行人、车辆的<span lang="EN-US">ReID</span>数据集讲解了训练方法;</span></p> <p style="text-indent: -21.0pt; mso-list: l0 level1 lfo1; background: white; margin: 0cm 0cm 0cm 21.0pt;"><!-- [if !supportLists]--><span lang="EN-US" style="font-size: 14.0pt; mso-bidi-font-size: 10.5pt; font-family: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings; color: black; mso-themecolor: text1;"><span style="mso-list: Ignore;">Ÿ<span style="font: 7.0pt 'Times New Roman';">  </span></span></span><!--[endif]--><span style="font-size: 10.5pt; font-family: '微软雅黑',sans-serif; mso-bidi-font-family: Arial; color: black; mso-themecolor: text1;">原理篇中讲解了马氏距离、匈牙利算法、卡尔曼滤波器的原理,并解读了<span lang="EN-US">SORT</span>和<span lang="EN-US">DeepSORT</span>论文;</span></p> <p style="text-indent: -21.0pt; mso-list: l0 level1 lfo1; background: white; margin: 0cm 0cm 0cm 21.0pt;"><!-- [if !supportLists]--><span lang="EN-US" style="font-size: 14.0pt; mso-bidi-font-size: 12.0pt; font-family: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings; color: black; mso-themecolor: text1;"><span style="mso-list: Ignore;">Ÿ<span style="font: 7.0pt 'Times New Roman';">  </span></span></span><!--[endif]--><span style="font-size: 10.5pt; font-family: '微软雅黑',sans-serif; mso-bidi-font-family: Arial; color: black; mso-themecolor: text1;">代码解析篇中使用<span lang="EN-US">PyCharm</span>单步调试对<span lang="EN-US">DeepSORT</span>的代码逐个文件进行讲解。课程提供注释后的代码。</span></p> <p style="text-indent: -21.0pt; mso-list: l0 level1 lfo1; background: white; margin: 0cm 0cm 0cm 21.0pt;"><span style="font-size: 10.5pt; font-family: '微软雅黑',sans-serif; mso-bidi-font-family: Arial; color: black; mso-themecolor: text1;"><img src="https://img-bss.csdnimg.cn/202105101512471836.jpg" alt="课程内容" /></span></p> <p><img src="https://img-bss.csdnimg.cn/202105101513384587.jpg" alt="行人多目标跟踪" /></p> <p><img src="https://img-bss.csdnimg.cn/202105101514053124.jpg" alt="车辆计数" /></p>
参与评论 您还未登录,请先 登录 后发表或查看评论
©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值