ofbiz实战5——创建学期管理新建和编辑页面
来源:互联网 发布:php static class 编辑:程序博客网 时间:2024/05/29 02:40
下面是实现的学期管理的编辑界面(新增和编辑在一起了实现了):
学期名称因为是主键,所以学期名称不能修改,只能作废,然后新增一个学期记录。
具体实现代码如下:
1. 配置controller.xml文件
<?xml version="1.0" encoding="UTF-8"?><site-conf xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ofbiz.apache.org/Site-Conf" xsi:schemaLocation="http://ofbiz.apache.org/Site-Conf http://ofbiz.apache.org/dtds/site-conf.xsd"> <include location="component://common/webcommon/WEB-INF/common-controller.xml"/> <include location="component://common/webcommon/WEB-INF/portal-controller.xml"/> <description>Booking Component Site Configuration File</description> <!-- Request Mappings --> <request-map uri="main"><security https="true" auth="true"/><response name="success" type="view" value="main"/></request-map><!-- ================ Term Requests ================= --> <request-map uri="FindTerm"> <security https="true" auth="true"/> <response name="success" type="view" value="FindTerm"/> </request-map> <request-map uri="EditTerm"> <security https="true" auth="true"/> <response name="success" type="view" value="EditTerm"/> </request-map> <request-map uri="createTerm"> <security https="true" auth="true"/> <event type="service" invoke="createTerm"/> <response name="success" type="view" value="EditTerm"/> <response name="error" type="view" value="EditTerm"/> </request-map> <request-map uri="updateTerm"> <security https="true" auth="true"/> <event type="service" invoke="updateTerm"/> <response name="success" type="view" value="EditTerm"/> <response name="error" type="view" value="EditTerm"/> </request-map> <!-- View Mappings --><view-map name="main" type="screen" page="component://booking/widget/booking/BookingScreens.xml#main"/> <view-map name="FindTerm" type="screen" page="component://booking/widget/term/TermScreens.xml#FindTerm"/><view-map name="EditTerm" type="screen" page="component://booking/widget/term/TermScreens.xml#EditTerm"/></site-conf>
2. 配置TermScreens.xml
<screen name="EditTerm"> <section> <actions> <set field="titleProperty" value="TermManange"/> <set field="headerItem" value="TermManange"/><!--<set field="termName" value="${parameters.termName}"/>--><entity-one entity-name="Term" value-field="term"/> </actions> <widgets> <decorator-screen name="CommonBookingDecorator" location="${parameters.mainDecoratorLocation}"> <decorator-section name="body"><container style="button-bar"><link target="FindTerm" text="${uiLabelMap.CommonBack}" style="buttontext"/></container> <screenlet title="${groovy: parameters.termName ? uiLabelMap.CommonEdit : uiLabelMap.CommonAdd}"> <include-form name="EditTerm" location="component://booking/widget/term/TermForms.xml"/> </screenlet> </decorator-section> </decorator-screen> </widgets> </section> </screen>
<form name="EditTerm" target="updateTerm" title="" type="single" header-row-style="header-row" default-table-style="basic-table" default-map-name="term" default-entity-name="Term"><alt-target use-when="term==null" target="createTerm"/><auto-fields-service service-name="updateTerm" map-name=""/><field use-when="term!=null" name="termName" title="${uiLabelMap.TermTermName}" tooltip="${uiLabelMap.BookingNotModification}." ><display/></field> <field use-when="term==null" name="termName" title="${uiLabelMap.TermTermName}" required-field="true"><text size="20" maxlength="20" /></field> <field name="beginTime" title="${uiLabelMap.TermBeginTime}" required-field="true"><date-time type="date" /></field><field name="endTime" title="${uiLabelMap.TermEndTime}" ><date-time type="date" /></field> <field name="used" title="${uiLabelMap.TermUsed}"> <drop-down allow-empty="false" no-current-selected-key="Y"><option key="Y" description="${uiLabelMap.CommonYes}"/> <option key="N" description="${uiLabelMap.CommonNo}"/> </drop-down> </field> <field name="submitButton" title="${uiLabelMap.CommonSubmit}"><submit/></field> </form>
4. 配置BookingUiLabels.xml
<property key="BookingNotModification"> <value xml:lang="en">BookingNotModification</value> <value xml:lang="zh">不能修改</value> </property>BookingEntityLabels.xml配置暂时随便配一条记录,否则不能正常使用auto-fields-service标签。
这样页面就完成。感觉配置起来很简单,不用自己写太多的代码,只要配置好后,相关逻辑就自动实现了。
5.总结
学习了auto-fields-service标签的使用。
学习了field标签use-when和required-field属性的使用。
学习了下拉框控件和日期控件的使用,以及drop-down标签的allow-empty和no-current-selected-key属性的使用。
学会配置【后退】按钮。
阅读全文
0 0
- ofbiz实战5——创建学期管理新建和编辑页面
- ofbiz实战4——创建学期管理查询界面
- ofbiz实战——学期管理界面以及代码
- ofbiz实战1——创建booking组件(实验室预约管理系统)
- ofbiz实战10——学生管理实现代码
- ofbiz实战——教师管理实现代码
- ofbiz实战——课程管理界面以及代码实现
- ofbiz实战——实验项目管理界面以及代码
- ofbiz实战3——创建booking项目首页
- ofbiz学习——创建一个查询页面
- ofbiz实战6——预约实验室管理系统所有实体定义
- ofbiz实战8——实验室预约管理系统功能介绍
- ofbiz实战——实验项目批次管理界面以及代码
- ofbiz实战——学生预约申请管理界面以及代码
- ofbiz实战——教师信息管理界面
- ofbiz实战——管理员信息管理界面
- 创建OFBiz的jQuery Mobile入门页面
- ofbiz实战2——配置booking系统菜单
- windows7原版镜像下载地址分享
- KDnuggets整理最新机器学习必备十大入门算法!都在这里了
- 将jar包导入本地仓库
- 欢迎使用CSDN-markdown编辑器
- SQLServer 提示
- ofbiz实战5——创建学期管理新建和编辑页面
- 【BigHereo 26】-----Summary My Examnation Days
- Git使用之码云的操作步骤
- 地址猜测攻击
- java并发编程实践第二遍笔记(三)20171021
- javamail方式发送邮件 直接上代码
- 1027. 打印沙漏(20)--Python
- BigDecimal加减乘除运算
- 网易云容器服务基于Kubernetes的实践探索