Grails-发送重定向参数中的对象列表
我的问题是,我想在索引视图上预览数据,而不将数据保存在数据库中。为此,我想发送重定向的params部分中的对象列表。在收到动作时,我想使用对象列表。但当我包括以下内容时Grails-发送重定向参数中的对象列表,grails,groovy,Grails,Groovy,我的问题是,我想在索引视图上预览数据,而不将数据保存在数据库中。为此,我想发送重定向的params部分中的对象列表。在收到动作时,我想使用对象列表。但当我包括以下内容时 def preview(){ //some code redirect action: "index", params:[planId:params.planId, beamsInfoList: beamsInfoList] } 我希望下面这样的事情发生 def index() { //some code t
def preview(){
//some code
redirect action: "index", params:[planId:params.planId, beamsInfoList: beamsInfoList]
}
我希望下面这样的事情发生
def index() {
//some code
try{
planInfo.beamInfo = (params.beamsInfoList==null)?planInfo.beamInfo:params.beamsInfoList //beamInfo is also list
//some code
Object[] obj = GRMUtils.calculateTotalBeamsPower(planInfo.beamInfo)
totalPlanPower = (Float)obj[0];
beamPowerMap= (Map<Integer, String>)obj[1];
AmMapUtility utility=new AmMapUtility()
output = utility.generateAMmapFromBeams(planInfo.beamInfo, GRMConstants.POWER_MAP_PAGE);
if(null==output){
flash.error = message(code: 'beammap.noinfoerror.message')
}
}catch(Exception e){
log.error "Excepton occured while loading Power Map", e
}
respond beams, model:[centerLong:output.getCenterLongitude(),centerLat:output.getCenterLatitude(),amMapImageProperty:output.getMapImages(),
amMapLinesProperty:output.getMapLines(), planId:params.planId, planInfo:planInfo, powersControlCarrier: powersControlCarrier, powersTrafficCarrier:powersTrafficCarrier,satPower: planInfo.satellite.satelliteMaxPower, totalPlanPower: totalPlanPower, gatewayPower: planInfo.gateway.gatewayAggregateEIRP,fesOutputPowerLimit:fesOutputPowerLimit, beamPowerMap: beamPowerMap,powerRangeColorMap:output.getReuseColorMap()]
}
在一些数据库获取上。我被卡住了。我不熟悉grails和groovy。请帮忙
编辑:我发现我的列表很大,这就是为什么它没有重定向。如果可能的话,请帮助我选择另一种方法,比如如何使用request属性?我想我已经解决了这个问题。现在开始工作了。我需要做的就是使用request setattribute作为
request.beams = beams
而且不需要在重定向的参数中传递列表,这是我以前经常做的。我没有使用重定向,而是使用forward,如下所示:
request.beams = beams
forward action: "index", params:[planId:params.planId]
request.beams = beams
forward action: "index", params:[planId:params.planId]