Solve the Problem of jspsession splicing strings for Obtaining values in the session field.
Cloudy weather in May 22, 2015
Problem description:
Background code:
// CaseId is string type Struts2Utils. getRequest (). getSession (). setAttribute (caseId + "idPhoto", idPhoto );
Jsp obtains the idPhoto value in the session field.
Incorrect syntax:
$ {Param. search_caseId + "idPhoto "}
Correct syntax 1:
<C: set var = "idPhotoName" value = "$ {param. search_caseId} idPhoto "scope =" page "/> <c: out value =" $ {session [idPhotoName]} "> </c: out>
Correct syntax 2:
<% String caseId = request. getParameter ("search_caseId"); String idPhotol = caseId + "idPhoto"; // of course, it can also be placed in other domains such as request, the idPhotol obtained in [] can ignore the pageContext domain. setAttribute ("idPhotol", idPhotol); %> <c: out value = "$ {session [idPhotol]}"> </c: out>