<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<form action="login" method="post">
账号:<input type="text" name="userName"/><br/>
密码:<input type="text" name="passWord"/><br/>
<input type="submit" value="登录"/>
</form>
<c:if test="${empty message} }">
<script type="text/javascript">
alert('${message}');
</script>
</c:if>
</body>
</html>
script没有效果?求大神解答
script代码块要写在script标签中
此处写javascript代码 <script type"text/javascript"> 此处添加javascript代码块</script>
这里是不是多了个}了??
<c:if test="${empty message} }">
<script type="text/javascript">
alert('${message}');
</script>
message有什么内容?如果包含单引号会导致字符串不闭合报错,自己将单引号替换为实体对象
'