weixin_33722405
weixin_33722405
2014-06-13 15:39

我可以在Ajax中创建EL吗?

  • jsp
  • ajax
  • jquery

What I want to do is "Once I login to webpage, I want to show related user name and role (eg Silvia As Admin)"

    <div class="collapse navbar-collapse">
                <div class="simplenav">
                    <form action="login.jsp">
                        <div id="Logdiv">
                            <button type="button" id="btnLogout" value="Logout"> Logout </button>
                            <button type="button" id="btnLogin" value="Login"> Login </button>
                        </div>
                    </form>         
                </div>
            </div>

.done(function(data){
    if(data.status == 200){
      $("#myModal").modal('toggle');
      $("#btnLogin").hide();
      $("#btnLogout").show();
      $("${requestScope.users.empName} As ${requestScope.users.role}").prependTo($("#Logdiv"));
   }
   else
      alert("Invalid Login Id and Password.");
   })

This part doesn't work .... $("${requestScope.users.empName} As ${requestScope.users.role}")

If I put "hi" instead of that, it works well...

In my servlet is ....request.setAttribute("users", emgr.Find(Integer.parseInt(userid)));

I'm struggling with that ... Thank you...

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答