如何将其转换为速度模板?
[英] How to convert this for velocity template?
本文介绍了如何将其转换为速度模板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有 html 内容.我想将其转换为速度模板.请提供将其转换为模板的步骤.
我还需要在数据库中插入 html.
以下是html:
<div class="divLabel" style="width: 70px;">数字:</div><div class="divInputField"><input id="$tags.searchStandard" type="text" style="width: 100px;"><script src='<s:url value=""></s:url>'type="text/javascript"></script><script type="text/javascript" charset="utf-8">addOnload(grouping());addOnload(initilizeStandardAutoComplete());
<div class="clear"></div>
<!-- 标准描述过滤器--><div class="divDescriptionFilter"><div class="divLabel" style="width: 70px;">说明:</div><div class="divInputField"><input id="$tags.standardFilter" type="text" style="width: 318px;"><script src='<s:url value=""></s:url>'type="text/javascript"></script><script type="text/javascript" charset="utf-8">addOnload(grouping());addOnload(initilizeStandardDescAutoComplete());
<div class="clear"></div>
<div id="standard_list" class="selection_property_div" style="padding-bottom: 5px;">
请帮忙..
解决方案
好吧,首先,要将其转换为 Velocity 模板,您必须 对您确切 有一个想法em> 想做.这是第 1 步.
然后开始在速度模板文件中编写代码.弄清楚哪个部分是动态的,即,将由 Velocity 模板引擎呈现.我想你已经知道了.
将其插入数据库. 你需要一个这样的表结构.
如果不存在则创建表模板(template_file_name varchar(50), -- 存放模板名称的列.html mediumblob, -- 实际上有速度模板的列.lastmod timestamp -- 包含最后修改信息的列.);
然后使用DataSourceResourceLoader
并进行配置(请阅读Velocity Docs以供参考).
从 DataSourceResourceLoader
的配置中制作一个 VelocityEngine
.
玩得开心.
--干杯,杰.
I have html content. I want to convert it to velocity template. Please provide the steps to be taken to convert it to template.
I need to insert the html in database also.
Following is the html :
<div class="divNumberFilter">
<div class="divLabel" style="width: 70px;">Number:</div>
<div class="divInputField">
<input id="$tags.searchStandard" type="text" style="width: 100px;">
<script src='<s:url value=""></s:url>' type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
addOnload(grouping());
addOnload(initilizeStandardAutoComplete());
</script>
</div>
<div class="clear"></div>
</div>
<!-- Standard Description filter -->
<div class="divDescriptionFilter">
<div class="divLabel" style="width: 70px;">Description:</div>
<div class="divInputField">
<input id="$tags.standardFilter" type="text" style="width: 318px;">
<script src='<s:url value=""></s:url>' type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
addOnload(grouping());
addOnload(initilizeStandardDescAutoComplete());
</script>
</div>
<div class="clear"></div>
</div>
<div id="standard_list" class="selection_property_div" style="padding-bottom: 5px;">
</div>
Please help..
解决方案
Okay first of all, to convert this into a Velocity template, you must have an idea what you EXACTLY want to do. That's step 1.
Then start writing the code in a velocity template file. Figure out what part would be dynamic, i.e., would be rendered by the Velocity Template Engine., which I guess you already know.
<input id="$tags.standardFilter" type="text" style="width: 318px;">
Inserting it into database.
You would need a table structure like this.
create table if not exists Templates (
template_file_name varchar(50), --The column to store the name of templates.
html mediumblob, --The column which actually has the velocity templates.
lastmod timestamp --The column which contains the last modification information.
);
Then use the DataSourceResourceLoader
and configure it (please read Velocity Docs for reference).
Make a VelocityEngine
out of the configurations of the DataSourceResourceLoader
.
have FUN.
--Cheers, Jay.
这篇关于如何将其转换为速度模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!