[英]how can i pass request object from one class to another
我在Webservice.java中有以下代码:
String userId = strUserID;
entity.setUserTerminal(requestBean.getChannel());
entity.setUserId(userId);
entity.setLoginPwd(requestBean.getPassword());
entity.setLoginID(requestBean.getLoginId());
String strEntityId = (String) authenticationHash.get("16");
entity.setEntityId(strEntityId);
request.setAttribute("langID", requestBean.getLangId());
WEBSERVICE_LOGGER.debug(logPrefix+"entity obj ::{} " + entity.toString());
request.setAttribute("entity", entity);
我无法获得此request.setAttribute(“ entity”,实体); 在另一个动作文件中,当我点击request.getAttribute(“ entity”);时,我得到的是null。
确保line- request.getAttribute(“ entity”); 在响应被提供之前被执行,因为在响应被提供之后请求参数立即被无效。。这可能是您获得空值的原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.