Solve the problem of JSP getting string concatenation of value in Sesion domain

Source: Internet
Author: User
Tags sesion

May 22, 2015 weather Overcast
Problem Description:
Background code:

//caseId为字符串类型Struts2Utils.getRequest().getSession().setAttribute"idPhoto", idPhoto);

JSP gets Idphoto Gets the value in the Session field
Error wording:

${param.search_caseId+"idPhoto"}

Correct wording one:

<c:setvar="idPhotoName"value="${param.search_caseId }idPhoto" scope="page" /><c:outvalue="${session[idPhotoName]}"></c:out>

Two correct wording:

<%    String caseId = request.getParameter("search_caseId");    String idPhotol = caseId + "idPhoto";    //当然,也可以放在request等其它的域中,在[]中取的idPhotol可以忽略域    pageContext.setAttribute("idPhotol", idPhotol);%><c:out value="${session[idPhotol]}"></c:out>

Solve the problem of JSP getting string concatenation of value in Sesion domain

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.