请教一段登录代码,AJAX验证的,用户名密码通过后ACTION中
String info = "欢迎您, " + user.getDlName() + " , 进入<a href='<%=request.getContextPath() %>/user/userCenter.action'>会员中心</a>";返回后,firebug查看路径就是<%=request.getContextPath() %>/user/userCenter.action'>会员中心</a>而不是“工程名”+/user/……请教如何才能返回工程名+/user/呢?

解决方案 »

  1.   

    我的意思是,绝对路径<%=request.getContextPath() %> 网页加载的时候不是能转成“项目名+action”么那我这个AJAX传过去的,页面上虽然也是<%=request.getContextPath() %>,但不是“项目名+action”,所以点击的话,URL直接变成了"http://localhost:8080/DEMO/%3C%=request.getContextPath%28%29%20%%3E/user/userInfo.action"
      

  2.   


    String info = "欢迎您, " + user.getDlName() + " , 进入<a href=" + request.getContextPath() + "/user/userCenter.action'>会员中心</a>";直接在后台写入不就行了,干嘛要再传到jsp页面上再去解析
      

  3.   

    直接在jsp页面写<a>标签 好一点吧,不用传过去解析
      

  4.   

    是这样,首页一段DIV里面的无刷新登录,可能是我的方法笨了点,但自己搞定了,把代码改成String info = "欢迎您, 尊敬的 " + user.getDlName() + " , 进入<a href='" + request.getContextPath() + "/user/userCenter.action'>会员中心</a>";搞定之后才看到了linminqin的代码,结贴