Print session attributes in jsp

后端 未结 4 657
温柔的废话
温柔的废话 2020-12-03 07:31

My webapp is ready but I just wanted to add a little dropdown menu with the username as title. This is my jsp code:

                

        
4条回答
  •  独厮守ぢ
    2020-12-03 08:04

    You can use EL, which is prefered in JSP.

    
    

    Or if the name value is HTML safe, you can use

    ${sessionScope.name}
    

    Make sure the JSP is allow access session.

    <%@ page session="true" %>
    

    To use core JSTL, make sure the following code is included.

    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    

提交回复
热议问题