怎么在jsp中使用javascript的alert?

如题所述

和在html文件中一样使用就可以了如:


<html>
<head>
<!--这个是引入js文件-->
<script src="" ></script>
</head>
<body>
<script>
//内嵌的js代码
</script>
</body>
</html>

温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-11-15
<script>alert('提示内容')</script>
第2个回答  2013-11-15
User userSession=(User) session.getAttribute("LOGINEN_USER");
第3个回答  2013-11-15
看下这个吧

User userSession=(User) session.getAttribute("LOGINEN_USER");
if(userSession == null || userSession.getStatus()!=0){
out.print("<script type='text/javascript'>alert('您尚未登录或者超时');</script>");
out.print("<script type='text/javascript'>location.href='../login.jsp'</script>");
}
相似回答