package org.ofbiz.practice;
import java.util.ArrayList;
import java.util.Locale;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.service.GenericServiceException;
import org.ofbiz.service.LocalDispatcher;
public class PracticeEvents {
public static final String module = PracticeEvents.class.getName();
public static final String resource = "PracticeUiLabels";
public PracticeEvents() {
// TODO Auto-generated constructor stub
}
public static String createPracticePersonJavaEvent(HttpServletRequest request, HttpServletResponse response){
LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin");
Locale locale = request.getLocale();
String salutation = (String) request.getParameter("salutation");
String firstName = (String) request.getParameter("firstName");
String lastName=(String)request.getParameter("lastName");
String middleName=(String)request.getParameter("middleName");
String suffix=(String)request.getParameter("suffix");
Map createPersonCtx = UtilMisc.toMap("salutation", salutation, "firstName", firstName, "lastName", lastName,
"suffix",suffix,
"middleName",middleName,
"userLogin", userLogin);
ArrayList messageList = new ArrayList();
if(null==firstName || firstName.length()==0)
{
messageList.add(UtilProperties.getMessage(resource,"PracticeFirstNameMissingError",locale));
}
if(null==lastName || lastName.length()==0)
{
messageList.add(UtilProperties.getMessage(resource,"PracticeLastNameMissingError",locale));
}
try{
Map person = dispatcher.runSync("createPracticePerson", createPersonCtx);
}catch (GenericServiceException e){
Debug.logError(e.toString(), module);
messageList.add(e.toString());
request.setAttribute("_ERROR_MESSAGE_LIST_", messageList);
return "error";
}
request.setAttribute("_ERROR_MESSAGE_LIST_", messageList);
return "success";
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
Ofbiz 官网上的OFBiz Tutorial - A Beginners Development Guide中的案例practice,其中内容有些是老版本的,与新版本(13版)并不兼容,尤其是Ajax部分已经有较大差异。同时有一部分操作和源代码没有在教程中说明或者只是简单一提带过,此份案例源代码在13版上完整实现了整个案例,可以帮助初学者避免学习官网教程时的疑惑。
资源推荐
资源详情
资源评论
收起资源包目录
practice.rar (43个子文件)
practice
ofbiz-component.xml 1KB
widget
CommonScreens.xml 2KB
PracticeForms.xml 4KB
PracticeScreens.xml 11KB
PracticeMenus.xml 2KB
script
org
ofbiz
practice
PracticeServices.xml 5KB
PracticeEvents.xml 1KB
src
org
ofbiz
practice
PracticeEvents.java 3KB
webapp
practice
WEB-INF
actions
Person.groovy 78B
web.xml 4KB
controller.xml 7KB
index.jsp 44B
CreatePerson.ftl 1KB
js
PracticeApp.js 2KB
Person.ftl 469B
build
javadocs
index-all.html 6KB
resources
titlebar_end.gif 849B
background.gif 2KB
titlebar.gif 10KB
tab.gif 291B
org
ofbiz
practice
package-summary.html 4KB
package-frame.html 815B
PracticeEvents.html 10KB
package-tree.html 4KB
stylesheet.css 11KB
allclasses-noframe.html 658B
allclasses-frame.html 678B
overview-tree.html 4KB
constant-values.html 5KB
package-list 20B
help-doc.html 8KB
deprecated-list.html 3KB
index.html 3KB
lib
ofbiz-practice.jar 45KB
classes
org
ofbiz
practice
PracticeEvents.class 3KB
config
PracticeUiLabels.xml 1KB
servicedef
secas.xml 399B
service_groups.xml 38B
services.xml 5KB
entitydef
entitymodel.xml 304B
eecas.xml 396B
data
PracticeData.xml 751B
lib
build.xml 2KB
共 43 条
- 1
资源评论
- ^一剪梅^2015-07-05该资源非常不错
liangsword
- 粉丝: 0
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- rainy-day.jpg
- IMG_20240501_171218.jpg
- Swift-内购封装swift版本
- 经典CNN网络之ResNet 图像分类网络实战项目:7种小麦叶片病害分类(迁移学习)
- Java毕设之ssm010基于ssm的新能源汽车在线租赁管理系统+vue.rar
- Java毕设之ssm009毕业生就业信息统计系统+vue.rar
- Java毕设之ssm008医院门诊挂号系统+jsp.rar
- Java毕设之ssm007亚盛汽车配件销售业绩管理统+jsp.rar
- Java毕设之ssm006基于java的少儿编程网上报名系统+vue.rar
- Java毕设之ssm005基于SSM框架的购物商城系统+jsp.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功