专业的检测用户是否“在线”是不是判断session的值?
问题一我把用户名设在session对象中 在<jsp:useBean scope="page">下 
session.getAttribute("username")返回的既然是空 
应该如何取得session.getAttribute("username")??问题二
<form name="frm1">
<input type="file" name="fileBrowse">
<input type="txt" name="txt1">为什么我提交到一个jsp里,request.getParameter("txt1")的值取到??

解决方案 »

  1.   

    1
     scope="page"> 
    既然你的 scope 是 page, 当然拿不到 session里面的值了,你存错地方了,改成
     scope="session"> 2 ??属于你的页面编码问题。
      a) 确认一下你的 html 的编码,就是 charset="GBK" 或者 GB2312 或者 UTF-8之类的
      b) 在你的jsp的前面
    <%@page contentType=...... // 你以前的代码
    <%request.setCharactorEncoding("GBK")%> // 这里的编码GBK根据你前面拿步查到的编码进行修改就可以了!
      

  2.   

    session.getAttribute() 是取得Session作用域里面的值 你的JavaBean是放在Page作用域的 只能在当前页面拿到值你应该放到Session作用域