struts redirect 带参数
程序员文章站
2022-07-10 15:11:09
...
<action name="addDefaultUserTag" class="userLableAction" method="addDefaultUserTag"> <result name="success" type="redirect">/user/userLable.action?appid=${appid}&app_platform=${app_platform}</result> </action>
public String addDefaultUserTag(){ getResponse().setCharacterEncoding("UTF-8"); appid = getRequest().getParameter("appid"); app_platform = getRequest().getParameter("app_platform"); long trace_id = 0; app = appService.getAppById(appid); if((app.getSupportdevice()==12 || app.getSupportdevice()==1) && ("Android".equals(app_platform))){ trace_id = appService.getTraceId(appid, app_platform); }else{ trace_id = appService.getTraceId(appid, "IOS"); app_platform ="IOS"; } getRequest().setAttribute("app_platform", app_platform); for (int i = 0;tagCode !=null && tagCode.length > 0 && i < tagCode.length; i++) { UserTag userTag = new UserTag(); userTag.setId(UUIDUtils.getUUID()); userTag.setAppId(appid); userTag.setAppPlatform(app_platform); userTag.setTraceId( (int)trace_id ); userTag.setTagCode(tagCode[i]); userTag.setTagName(UserTagConfigurer.getContextProperty(tagCode[i]).getName()); userTag.setTagIcon(UserTagConfigurer.getContextProperty(tagCode[i]).getPic()); userTag.setReadflag(UserTagConfigurer.getContextProperty(tagCode[i]).getDes()); User user = (User) getSession().getAttribute(Constants.SESSION_USER); userTag.setInsertTime(DatetimeUtil.formatYMDHMS(new Date())); userTag.setUserId(user.getUserid()); userTag.setTagType("默认标签"); userTag.setTagTypeCode(0); userTag.setStatus(0); try{ userTagService.saveUserTag(userTag); }catch(Exception e) { logger.error(" userTag save error"); } } getRequest().setAttribute("appid", appid); getRequest().setAttribute("app_platform", app_platform); return SUCCESS; }
捐助开发者
在兴趣的驱动下,写一个免费
的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 当然,有钱捧个钱场(右上角的爱心标志,支持支付宝和PayPal捐助),没钱捧个人场,谢谢各位。
谢谢您的赞助,我会做的更好!
上一篇: 面试编程题的实验