您的位置:首页 > 其它

分布式块设备复制(DRBD)基本环境搭建

2014-11-29 20:20 246 查看
本文首先感谢网上的Ofbiz的博客文章!!! 

从controller.xml中
<request-map uri="login">
<security https="true" auth="false"/>
<event type="java" path="org.ofbiz.webapp.control.LoginWorker" invoke="login"/>
<response name="success" type="view" value="main"/>
<response name="error" type="view" value="login"/>
</request-map>

因此:
<view-map name="login" type="screen" page="component://party/widget/partymgr/CommonScreens.xml#login"/>

CommonScreens.xml文件中

<screen name="login">
<section>
<widgets>
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<platform-specific>
<html><html-template location="component://common/webcommon/login.ftl"/></html>
</platform-specific>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>

Login.flt中

<img align=absbottom vspace=2 border=0 src="<@ofbizUrl>/CreateImage?Image=${encryRandom}&Rgb=255|0|0</@ofbizUrl>" title="验证码图片"></p>

<#assign random = Static["org.ofbiz.webapp.control.Picture"].getRandom()>
<#assign encryRandom = Static["org.ofbiz.webapp.control.Picture"].manage(random)>

controller.xml文件中

<!--pht-->
<request-map uri="CreateImage">
<event type="java" path="org.ofbiz.webapp.control.CreateImage" invoke="make"/>
<response name="success" type="none"/>
<response name="error" type="none"/>
</request-map>

LoginWorker.java 类中的login方法:

String attach = null;
String get_attach = null;
if (attach == null)
attach = request.getParameter("attach");
if (get_attach == null)
get_attach = request.getParameter("get_attach");
if (get_attach == null) {
String errMsg = "系统错误,请再次登录!";
request.setAttribute("_ERROR_MESSAGE_", errMsg);
return "error";
}
String tmp = Picture.discrypt(get_attach);
if (!attach.equals(tmp)) {
String errMsg = "请输入正确的验证码!";
request.setAttribute("_ERROR_MESSAGE_", errMsg);
return "error";
}

因此在login.flt 中:
<#assign attach = Static["org.ofbiz.webapp.control.Picture"].discrypt(encryRandom)>
<input type="text" class="inputBox" name="attach" value="${attach}" size="4"/>

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: