谢谢
最好能给具体例子

解决方案 »

  1.   

    <%@ page language="java" pageEncoding="UTF-8"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        
        
        <title>MyJsp.jsp</title> <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->  </head>
      
      <body>
        <%
        HttpSession s = request.getSession(); 
        s.setAttribute("name","test");
        %>
        得到Session的值是<%=s.getAttribute("name") %>
        <br>
      </body>
    </html>
      

  2.   

    session设置:
    session.setAttribute("username",username);
    session.setAttribute("password",password);
    session获取:
    username=session.getAttribute("username");
    password=session.getAttribute("password");
    lz是想要这个吗?
      

  3.   


    <%HttpSession Session = request.getSession();
             String sesStr = (String)Session.getAttribute("aaa");
             %>
      

  4.   

    session设置: 
    session.setAttribute("username",username); 
    session.setAttribute("password",password); 
    session获取: 
    username=session.getAttribute("username"); 
    password=session.getAttribute("password"); 
      

  5.   

    赋值用
    session.setAttribute('name',Object);
    取值用
    session.getAttribute('name');
      

  6.   

    上面的都是对的
    楼主如果还想使用EL的话, 可以这样调用${sessionScope.variable}来获取值.variable为你设定的key值,如上面他们所用的name, username等
      

  7.   

    去看下J2EE的API
       HttpSession
      

  8.   

    jsp中session是内置的不需要 HttpSession s = request.getSession(); 
      

  9.   

    jsp中用session要加bean标签吗,我初学不要笑话我
      

  10.   

    如果你想在script中使用session对象的话, 直接用就可以了, 是内置的. 如<% session.getAttribute("var"); .... %>
      

  11.   

    session.getAttribute("username");