<%
if (session.getAttribute(UsernamePasswordAuthenticationFilter.SPRING_SECURITY_LAST_EXCEPTION_KEY) != null) {
%>
<span style="color:red"> 登录失败,请重试. </span>
<%
}
%>
<script language="JavaScript">
<!--
if ("<%= request.getParameter("error")%>" == "true") {
alert("invalid username/password" );
}
//-->
</script>
</html>
<SCRIPT type="text/javascript">
<!--
alert ("${sessionScope['SPRING_SECURITY_LAST_USERNAME']}" + ";" + "${sessionScope.userRole}");
// alert(<sec:authentication property="name"/> + ";" + <sec:authentication property="principal.username"/>);
<%
User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
%>
alert("<%=user.getRoles().toString()%>");
//-->
</SCRIPT>