怎么在jsp中使用javascript的alert?

如题所述

第1个回答  推荐于2019-11-13

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>");

}

<html>

<head>

<!--这个是引入js文件-->

<script src="" ></script>

</head>

<body>

<script>

//内嵌的js代码

</script>

</body>

</html>

本回答被网友采纳
相似回答