Print session attributes in jsp

后端 未结 4 663
温柔的废话
温柔的废话 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 07:55

    In your servlet:

     1) get your parameter:
    
        String param = request.getParameter("param");
    
     2) send it to the request object as an attribute:
    
        request.setAttribute("param", param);
    

    In your JSP:

       use JSTL, and EL to return the attribute you sent from your servlet:
    
       " />
    

    and there you go.

提交回复
热议问题