在此代碼中,我使用ActionContext從Request對象獲取Session和ServletActionContext。我覺得這是不好的做法,因爲只有Action對象只能用於Request對象。如何使用ActionContext中的參數,請求和會話對象?
ActionContext的Request對象是否等價於Servlet中的Request對象?如果是,如何使用它獲取請求參數?
Map session = (Map) ActionContext.getContext().getSession();
HttpServletRequest request = ServletActionContext.getRequest();
String operatorId = request.getParameter("operatorId");
session.put("OperatorId", operatorId);
// getting hashmap from Bean
analysisNames= slsLoginDetailsRemote.getAnalysisNamesIdMap();
// sending map for multiselect
session.put("AnalysisNames",analysisNames);
use request.getParameter(「parameter_name」); –