首页 > Java > java教程 > 正文

javaWeb开发过程中小细节总结分享(一)

黄舟
发布: 2017-03-17 11:08:30
原创
1736 人浏览过

初次接触freemark和bootstrap,使用过程中会遇到很多需要注意的小细节。此博文将不断的总结本人在使用过程中遇到的问题。

1.freemark 时间设置

<span class="control-label ">${content.createTime?string(&#39;yyyy-MM-dd HH:mm:ss&#39;)}</span>
登录后复制

2.if /list标签的使用

<#if questionAnswers??>
<#list questionAnswers as answers>
<input type="hidden" name="questionAnswerId" id="questionAnswerId" value="${answers.questionAnswerId}"/>
<p style="
padding
: inherit;b
ord
er-
top
:1px solid #808080">
<p class=" control-label" id="answer" >${answers.answerContent}</p>
<p class="control-label">
<span class="control-label" > 回答者:${answers.createUserName}</span>
<span class=" control-label">${answers.createTime?string(&#39;yyyy-MM-dd HH:mm:ss&#39;)}</span>
</p>
</p>
</#list>
</#if>
登录后复制

3.p添加内容

4.确认框

function 
delete
QuestionAnswers(contentIds){
confirmOptions.content ="请确认是否
删除
?";
confirmOptions.confirm = function (){
$.ajax({
type: "POST",
cache
: false,
data:{contentIds:contentIds.join(",")},//后台
传值
url: "/pmms/question/verify/delete",
success: function (
json
Object
 , success , response) {
$(&#39;#questionTable&#39;).bootstrapTable(&#39;refresh&#39;);
toastr.success(&#39;删除成功!&#39;, &#39;成功提醒&#39;);
},
error: function (xhr, ajaxOptions, thrownError) {
toastr.error(thrownError, &#39;失败提醒&#39;);
}
});
}
$.confirm(confirmOptions);
}
登录后复制


5.前端调试方法

前端调试方法
6.freemark弹出一个页面

 <a href="#add" class="btn green btn-sm"data-toggle="modal"id="addTem"> 新增 </a>
登录后复制

在页面中包含要弹出的页面

<#include "window_add_edit.ftl"/>
登录后复制

此页面的id设置为 add ,和a标签中的href要想对应

7.富文本

$(&#39;#addSummernote&#39;).summernote({
lang
: &#39;zh-CN&#39;,
height
: 100,  
focus: true,
airPopover: [
   [&#39;color&#39;, [&#39;color&#39;]],
   [&#39;font&#39;, [&#39;bold&#39;, &#39;underline&#39;, &#39;
clear
&#39;]],
   [&#39;para&#39;, [&#39;ul&#39;, &#39;paragraph&#39;]],
   [&#39;table&#39;, [&#39;table&#39;]],
   [&#39;insert&#39;, [&#39;link&#39;, &#39;picture&#39;]]
]
});
登录后复制


富文本调样式后,存到数据库中的标签中使双引号,当需要把文本写到富文本中时,使用 ‘ ’ 操作。

8.bootstrap中时间是long型时,转换方式


9.自动刷新页面,防止session失效


10.修改form表单的action

//
document
.dbform.action = &#39;question/verify/save&#39;;
JS方式
 
$(&#39;#form-group&#39;).attr(&#39;action&#39;,&#39;question/verify/save&#39;);
 
jQuery
方式
登录后复制

以上是javaWeb开发过程中小细节总结分享(一)的详细内容。更多信息请关注PHP中文网其他相关文章!

相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!