Cas登录页面修改——jsp页面中文乱码

  Cas是单点登录时候使用的,cas是什么不是本节课的重点,之后我们会进行一系列的讲解,我们知道一点就是用于登录时判断使用的就可以了。

  默认情况下cas的登录页面是:


  为了修改显示,改成我们需要的样式,需要进行下面的几个jsp文件以及配置文件的修改。

  首先这个总的页面是由casserver端的三个页面拼合而成的。


  三个页面的主要位置是:

  首先找到cas目录,打开【F: \资料\tomcat-cas\webapps\cas】目录,cas中关于服务端的认证以及页面配置文件的操作都是在这里进行的。

  主页面的就是统一认证页面:cas目录/WEB-INF/view/jsp/default/ui 文件夹里,其中casLoginView.jsp为登陆页面。


  其他的两个页面是:


  默认之前的页面显示是不含有中文的,故而页面不会出现乱码的问题,现在我们要将其修改为我们需要的样式,比如下面这样的:


  那么我们需要修改top和bottom两个文件,因为是分着的两个文件,最终被统一登录页面包装为一个页面。

  两个页面的代码是:

  top.jsp页面:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page session="true" %>
<%@ page pageEncoding="UTF-8" %>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<spring:theme code="mobile.custom.css.file" var="mobileCss" text="" />
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
	<head>
	    <title>CAS - Central Authentication Service</title>
        <c:if test="${not empty requestScope['isMobile'] and not empty mobileCss}">
             <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
             <meta name="apple-mobile-web-app-capable" content="yes" />
             <meta name="apple-mobile-web-app-status-bar-style" content="black" />
        </c:if>
		<spring:theme code="standard.custom.css.file" var="customCssFile" />
        <link type="text/css" rel="stylesheet" href="<c:url value="${customCssFile}" />" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	    <link rel="icon" href="<c:url value="/favicon.ico" />" type="image/x-icon" />
	</head>
	<body id="cas" class="fl-theme-iphone">
    <div class="flc-screenNavigator-view-container">
        <div class="fl-screenNavigator-view">
            <div id="header" class="flc-screenNavigator-navbar fl-navbar fl-table">
				<h1 id="company-name">tgb</h1>
                <h1 id="app-name" class="fl-table-cell">高校云平台</h1>
            </div>		
            <div id="content" class="fl-screenNavigator-scroll-container">

  bottom.jsp页面:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page pageEncoding="UTF-8" %>
</div>
                <div id="footer" class="fl-panel fl-note fl-bevel-white fl-font-size-80">
                	<a id="jasig" href="http://www.jasig.org" title="go to Jasig home page"></a>
                    <div id="copyright">
                        <p>Copyright &copy; 2014 - 2015 tgb, CHN. All rights reserved.</p>
                       <p>Powered by <a href="http://baike.baidu.com/subview/7744517/7640221.htm">廊坊师范学院 信息技术提高班 第10期</a></p>
                    </div>
                </div>
            </div>
        </div>
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js"></script>
        <script type="text/javascript" src="<c:url value="/js/cas.js" />"></script>
    </body>
</html>

  其中值得注意的是两个地方:


  如果不设置bottom.jsp页面的编码,将会出现这样的情况:


  那么pageEncodingcharset的区别是什么呢?

  区别就是:pageEncoding=“utf-8”是jsp文件本身的编码

  contentType="text/html;charset=UTF-8"的charset是指服务器发送给客户端时的内容编码。

  具体参加:http://blog.csdn.net/zndxlxm/article/details/7889980

评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值