完整版見https://jadyer.cn/2015/07/16/sso-cas-login-diy/
/**
* @see ------------------------------------------------------------------------------------------------------------------------
* @see CAS個性登入頁
* @see 0.cas的頁面顯示控制是集中在\WEB-INF\cas.properties中的cas.viewResolver.basename屬性的,它的值預設是default_views
* @see 是以cas會去classpath中尋找default_views.properties,在default_views.properties中指定了登入登出頁面等
* @see 1.修改cas.properties檔案,cas.viewResolver.basename=msxf,再拷貝default_views.properties為msxf.properties
* @see 2.修改msxf.properties檔案,/WEB-INF/view/jsp/default改為/WEB-INF/view/jsp/msxf
* @see 其中casLoginView.url表示預設登入頁,casLoginGenericSuccessView.url表示預設登入成功頁
* @see 3.複制/WEB-INF/view/jsp/default/及其子目錄所有檔案到/WEB-INF/view/jsp/msxf/中
* @see 接下來就可以随意修改登入頁面了
* @see 注意\WEB-INF\view\jsp\msxf\ui\includes\bottom.jsp頁面中引用了googleapis的一些jquery庫
* @see 可以換成百度CDN(http://cdn.code.baidu.com/)的,比如http://apps.bdimg.com/libs/jqueryui/1.10.2/jquery-ui.min.js
* @see ------------------------------------------------------------------------------------------------------------------------
* @create 2015-7-16 下午4:56:17
* @author 玄玉<http://blog.csdn.net/jadyer>
*/
下面是我修改的casLoginView.jsp
<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" scope="session"/>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8"/>
<title>CAS單點登入系統</title>
<link rel="icon" type="image/x-icon" href="${ctx}/favicon.ico" target="_blank" rel="external nofollow" />
<script type="text/javascript" src="${ctx}/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="${ctx}/js/jquery-ui-1.10.2.min.js"></script>
<script type="text/javascript" src="${ctx}/js/cas.js"></script>
<!--[if lt IE 9]>
<script src="${ctx}/js/html5shiv-3.7.2.min.js" type="text/javascript"></script>
<![endif]-->
</head>
<style>
body {background-color: #CBE0C9;}
#msg {padding:20px; margin-bottom:10px;}
#msg.errors {border:1px dotted #BB0000; color:#BB0000; padding-left:100px; background:url(${ctx}/images/error.gif) no-repeat 20px center;}
</style>
<body>
<c:if test="${not pageContext.request.secure}">
<div id="msg" class="errors">
<h2>Non-secure Connection</h2>
<p>You are currently accessing CAS over a non-secure connection. Single Sign On WILL NOT WORK. In order to have single sign on work, you MUST log in over HTTPS.</p>
</div>
</c:if>
<form:form method="post" commandName="${commandName}" htmlEscape="true">
<!--
cssClass用于指定表單元素CSS樣式名,相當于HTML元素的class屬性
cssStyle用于指定表單元素樣式,相當于HTML元素的style屬性
cssErrorClass用于指定表單元素發生錯誤時對應的樣式
path屬性用于綁定表單對象的屬性值,它支援級聯屬性,比如path="user.userName"将調用表單對象getUser.getUserName()綁定表單對象的屬性值
-->
<form:errors path="*" id="msg" cssClass="errors" element="div" htmlEscape="false"/>
<input type="hidden" name="lt" value="${loginTicket}"/>
<input type="hidden" name="execution" value="${flowExecutionKey}"/>
<input type="hidden" name="_eventId" value="submit"/>
<table >
<tr>
<td>
<c:if test="${not empty sessionScope.openIdLocalId}">
<strong>${sessionScope.openIdLocalId}</strong>
<input type="hidden" name="username" value="${sessionScope.openIdLocalId}"/>
</c:if>
<c:if test="${empty sessionScope.openIdLocalId}">
<form:input tabindex="1" path="username" placeholder="帳号" htmlEscape="true" maxlength="16" size="25"/>
</c:if>
</td>
</tr>
<tr>
<td>
<form:password tabindex="2" path="password" placeholder="密碼" htmlEscape="true" maxlength="16" size="25"/>
</td>
</tr>
<tr>
<td>
<input type="checkbox" tabindex="3" name="warn" value="true"/>
<label for="warn">轉向其他站點前提示我</label>
</td>
</tr>
<tr>
<td>
<input type="submit" tabindex="4" value="登入"/>
</td>
</tr>
</table>
</form:form>
</body>
</html>
下面是我修改的casGenericSuccess.jsp
<%@ page pageEncoding="UTF-8"%>
<body style="background-color:#CBE0C9;">
<span style="color:red; font-size:64px; font-weight:bold;">登入成功</span>
</body>
下面是效果圖