弹窗地址1

 @RequestMapping(value = "/profile", method = RequestMethod.GET)    public String addressesPage(ModelMap model,                                HttpSession session) {

        try {            UserInfo userInfo = getUserInfoBySpring();            List<Address> address = getPrimaryAddress(userInfo.getUserId());//            AddressForm addressForm = getAddressFormFromAddress(address);//            model.addAttribute(AddressForm.class.getSimpleName(), addressForm);            model.addAttribute("addresses", address);

        } catch (GcommerceException gcommerceException) {            if (logger.isErrorEnabled()) {                logger.error("addresses Exception", gcommerceException);            }        }

        return "profile";    }
@RequestMapping(value = "/update", method = RequestMethod.GET)public String addAddress(ModelMap model,                         HttpServletRequest request, @RequestParam(value = "id", required = false) Long id,                         HttpSession session) {

    try {        if (id != null && id > 0) {

            Address address = userAccountService.findAddress(id);            AddressForm addressForm = getAddressFormFromAddress(address);            model.addAttribute("AddressForm", addressForm);        } else {            model.addAttribute(AddressForm.class.getSimpleName(), new AddressForm());        }    } catch (Exception e) {        if (logger.isErrorEnabled()) {            logger.error("addAddress", e);        }

    }    return "updateAddress";}
@RequestMapping(value = "/profile", method = RequestMethod.POST)public String addresses(ModelMap model,                        @Valid @ModelAttribute("AddressForm") AddressForm addressForm,                        BindingResult result,                        HttpSession session) {

    UserInfo userInfo = getUserInfoBySpring();    try {        if (!result.hasErrors()) {            if (addressForm.getId() == 0) {                Address address = getAddressFromAddressForm(addressForm);                if (address.isPrimary() == true) {                    List<Address> addressList = userAccountService.getUserAddresses(getUserInfoBySpring().getUserId());                    for (int i = 0; i < addressList.size(); i++) {                        Address temp = addressList.get(i);                        temp.setPrimary(false);                        userAccountService.updateAddress(temp, userInfo.getUserId());                    }                }

                address = userAccountService.addAddress(address, userInfo.getUserId());                if (address != null) {                    addressForm.setId(address.getId());                }            } else if (addressForm.getId() > 0 && addressForm.isDeleteOperation() == false) {                Address address = getAddressFromAddressForm(addressForm);                if (address.isPrimary() == true) {                    List<Address> addressList = userAccountService.getUserAddresses(getUserInfoBySpring().getUserId());                    for (int i = 0; i < addressList.size(); i++) {                        Address temp = addressList.get(i);                        temp.setPrimary(false);                        temp = userAccountService.updateAddress(temp, userInfo.getUserId());                        System.out.println(temp);                    }                }

                address = userAccountService.updateAddress(address, userInfo.getUserId());                if (address != null) {                    addressForm.setId(address.getId());

                }            } else if (addressForm.getId() > 0 && addressForm.isDeleteOperation()) {                userAccountService.removeAddress(addressForm.getId(), userInfo.getUserId());                model.addAttribute(AddressForm.class.getSimpleName(), new AddressForm());            }        }

    } catch (Exception e) {        if (logger.isErrorEnabled()) {            logger.error("addresses Exception", e);        }    }

    model.addAttribute("updated", true);    return "updateAddress";}

获取省市

@RequestMapping(value = "/getStatesAndCities.json", method = RequestMethod.GET)public@ResponseBodyMap<String, String> getStatesAndCities(@RequestParam(value = "deliveryStateId", required = false) Integer deliveryStateId,                                       @RequestParam(value = "deliveryCountryId", required = false) Integer deliveryCountryId,                                       @RequestParam(value = "stateId", required = false) Integer stateId,                                       @RequestParam(value = "countryId", required = false) Integer countryId,                                       HttpServletRequest request,                                       HttpSession session) throws Exception {    Map<String, String> result = new TreeMap<String, String>();    Locale locale = getRequestLanguage(session, request);    if (stateId != null && stateId > 0) {        result = referenceDataService.getCitiesByStateId(-1, -1, "id", "desc", stateId, locale.toString());

        return result;    }    if (deliveryStateId != null && deliveryStateId > 0) {        result = referenceDataService.getCitiesByStateId(-1, -1, "id", "desc", deliveryStateId, locale.toString());

        return result;    }    if (countryId != null && countryId > 0) {        result = referenceDataService.getStatesByCountryId(-1, -1, "id", "desc", countryId, locale.toString());        return result;    }    if (deliveryCountryId != null && deliveryCountryId > 0) {        result = referenceDataService.getStatesByCountryId(-1, -1, "id", "desc", deliveryCountryId, locale.toString());        return result;    }

    return result;}
时间: 2024-12-07 16:08:36

弹窗地址1的相关文章

UEditor添加自定义弹窗 插入音频地址

修改ueditor.config.js文件 在ueditor.config.js文件中,找到toolbars参数,增加一个"audio"字符串,对应着添加一个labelMap,用于鼠标移上按钮时的提示. //工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的从新定义 , toolbars: [[ 'fullscreen', 'source', '|', 'undo', 'redo', '|', 'bold', 'italic', 'underline', 'fo

VB.NET-QQ新闻弹窗样式图片制作工具

〇.下载地址 本程序的下载地址(百度网盘):http://pan.baidu.com/s/1qWBGGGG 一.关于本程序 Gnaea是一个QQ新闻弹窗的填字工具,可以在输入新闻标题和新闻内容后生成一张类似QQ新闻弹窗的图片.生成的图片可以被保存为BMP和PNG两种格式,或是直接复制到剪贴板. 效果如下图(注:内容纯属虚构) 二.程序控件 三.程序资源 被用作素材的资源:My.Resources.PopUp,取材于一张PNG格式的图片 四.程序代码 Imports System.Text Pub

所有软件下载地址

目录 网络: 远程连接 网络工具 抓包软件 系统: 系统工具 Linux工具 虚拟化软件 远程连接:------------------------------------------------------ Remote Desktop Manager远程桌面管理工具 官网:http://remotedesktopmanager.com/ 下载地址:http://remotedesktopmanager.com/Home/Download 请点击一下:返回目录 灰鸽子远程控制软件 百度云下载地

wex5实战之管理收货地址(二)

接着上一张管理收货地址,这章主要讲解新增,编辑,选择省市区功能,主要有windowReceiver.windowDialog.tree组件的使用. 1.新增.编辑地址,页面. 在页面中放入windowReceiver.windowDialog组件 windowReceiver:用于接收地址参数,判断是否为新增或编辑. windowDialog:用于打开选择省市区弹窗,返回选择数据. Model.prototype.windowReceiver1Receive = function(event){

iOS框架—使用地址簿

一.为何支持地址簿很重要: 当开发iOS软件的时候,就与用户的移动生活建立了联系.用户走到哪里都带着移动设备,可以说移动设备与用户的个人生活(从日历到个人相册)休戚相关.在这种移动生活中,通讯录占据着重要的位置.应用可以使用联系人数据库确定用户是否有朋友注册了相关服务:分析联系人的电子邮件地址或电话号码,并将联系人自动添加为好友.应用还可以使用联系人列表自动填写邮件地址或电话号码,或让用户通过蓝牙与朋友分享联系人信息.应用需要访问用户通讯录的原因不胜枚举. 注意: 除非有充分的理由,否则不要访问

用 eric6 与 PyQt5 实现python的极速GUI编程(系列04)---- PyQt5自带教程:地址簿(address book)

[引子] 在PyQt5自带教程中,地址簿(address book)程序没有完全实现界面与业务逻辑分离. 本文我打算用eric6+PyQt5对其进行改写,以实现界面与逻辑完全分离. [概览] 1.界面: 2.功能简介:程序有三种操作模式:浏览模式.添加模式.编辑模式. 其实现的功能都显式的体现在各个按钮上 3.主要步骤:1).在eric6中新建项目,新建窗体,取名为 addressbook.ui 文件 2).(自动打开)进入PyQt5 Desinger,编辑图形界面,保存 3).回到eric 6

Android重构与设计之路,从整理提示对话框弹窗开始

封装一个独立弹窗Module,这里的弹窗包括普通的Dialog方式弹框和WindowManager方式弹窗.提供一种管理项目里面弹窗的方案,便于后期修改和维护. 首先描述一个在大项目中普遍存在的一个现象:由于项目的功能多,负责功能的人不同,当功能中需要一个普通的确定取消对话框时,大部分人都选择自己写了一个,自己new一个独立的弹窗出来.这样做的好处有以下几个: 代码逻辑独立,自己写的代码自己能控制 快速方便,便于修改,便于满足各种奇怪的需求 可是这个做法导致项目中存在大量的代码冗余,大量的分散的

Web Dynpro 如何生成弹窗

1. 弹出窗口为Webdynpro窗口 在Webdynpro Component里建好一个窗口,取名 W_POPUP 在要生成弹窗的事件中写以下代码: DATA lo_nd_error_message TYPE REF TO if_wd_context_node. DATA lo_el_error_message TYPE REF TO if_wd_context_element. DATA lo_window_manager TYPE REF TO if_wd_window_manager.

jquery.sobox 经典版弹窗控件

sobox 是一款非常实用的,基于 jQuery 的弹窗控件.功能非常完整,而代码量又非常少(压缩完仅8k不到)的一款弹窗控件,如果你熟悉ext的弹窗控件,那么sobox的使用对你来说应该是愉悦而完全没有压力. 引入sobox文件 <link type="text/css" rel="stylesheet" media="all" href="style.css" /> <script type="