getParameter

$('#location').on('click',function(){
            layer.open({//调用layer弹出层 
                type: 2,
                title: '地图位置',
                scrollbar: false,
                maxmin: false,
                shadeClose: false, //点击遮罩关闭层
                area : ['1000px' , '500px'],
                content: '${ctx}/office.action?method:getLocation&office.id=${ office.id }&pageNo=${ param.pageNo }&pageSize=${ param.pageSize }&conditionStr=${ conditionStrEncoded}'

            });
        });
'${ctx}/office.action?method:getLocation&office.id=${ office.id }&pageNo=${ param.pageNo }&pageSize=${ param.pageSize }&conditionStr=${ conditionStrEncoded}'
通过这种方法来传递到指定的getLocation方法,并且传过去office.id、pageNo、pageSize、conditionStr等参数值,不然会出现错误。

2,

public String getLocation(){
        return "office_map";
    }
通过getLocation的return "office_map"到对应的result的jsp文件。
@ParentPackage(value="erp")
@Results({
    @Result(name="list", location="/erp/office/office_list.jsp"),
    @Result(name="editForm", location="/erp/office/office_edit_form.jsp"),
    @Result(name="office_map", location="/erp/office/office_map.jsp"),
})

3,

<input type="hidden" name="office.longitude" id="office_longitude" value="${ office.longitude}"/>
<input type="hidden" name="office.latitude" id="office_latitude" value="${ office.latitude}"/> 
<button type="submit" id="confirm" class="btn btn-sm btn-primary savaBtn" name="method:editFormTo">确认</button>
跳转到editFormTo方法中
public String editFormTo(){
        Double lon = (Double) getParameter( "office.longitude", Double.class);
        Double lat = (Double) getParameter( "office.latitude", Double.class);通过getParameter拿到jsp文件中的name属性名对应的值。
        String address=(String)getParameter("office.address", String.class);
        String sql = "from Office where id ="+office.getId()+"";
        offices = manager.find(sql);
        office = offices.get(0);
        if(lon>0){
            office.setLongitude(lon);
        }
        if(lat>0){
            office.setLatitude(lat);
        }
        office.setAddress(address);
        对其进行赋值。
        return EDITFORM;
    }

重要的一个事情,就是值的传递。。可以通过url的方式& 传递值,
或者通过request的getParameter方法拿到对应的name属性对应的值。byName。
而定义的

<input type="hidden" name="office.longitude" id="office_longitude" value="${ office.longitude}"/>
在jsp中通过document.getElementById来拿到。
var latitude = document.getElementById("office_latitude").value;
在对应的调用的action的方法中通过Double lon=(Double)getParameter("office.longitude",Double.class);来拿到
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值