2012-03-16 44 views
0

如果有使用WebFont的Spring登錄表單。當我第一次提交登錄表單時,瀏覽器會提供.ttf版本的Web字體供下載。如果我然後中止下載並再次點擊提交按鈕,登錄工作,我得到重定向。這個錯誤在每次登錄時都是可重現的(在那裏沒有意外),只有在清除緩存後才能在FF 10上重現。這隻會發生在設置爲發佈的方法中。獲得作品正常,但這顯然沒有解決方案的登錄表...Webfont提供在表單上下載

任何想法可能是什麼原因會有所幫助。

的代碼非常直接:

這裏的CSS文件:

@charset "utf-8"; 

/* first for IE 6/7/8 */ 
@font-face { 
    font-family: KievitWebProBook; 
    src: url(/fonts/KievitWebPro-Book.eot); 
    src: url(/fonts/KievitWebPro-Book.eot?) format('eot'), 
     url(/fonts/KievitWebPro-Book.woff) format('woff'), 
     url(/fonts/KievitOffcPro-Book.ttf) format('truetype'); 
} 

body { font-family: KievitWebProBook, sans-serif; } 
div.logo { margin-left: auto; margin-right: 150px; margin-top: 100px; text-align: right; } 
div.header { width: 90%; margin: 0px auto 20px auto; color: #788995; font-size: 24px; padding-left: 300px;} 
div.divider { width: 90%; margin-left: auto; margin-right: auto; height: 5px; background-image: url(/images/gradient5px.png); background-repeat: repeat-x;} 
table { margin-top: 40px; margin-left: 300px; width: 330px; background-color: #eaedef; padding: 10px;} 
td.header { text-align: center; font-size: large; padding: 5px; } 
td.error { color: #0076ae; font-size: small; } 
td.errorcode { color: #98a5ae; font-size: small; text-align: right; font-size: 12px;} 
td.input input { width: 100%; color: #a6b1b9; font-size: 12px; } 
td.submit { text-align: left; width: 50% } 
td.subtext { text-align: right; color: #0076ae; font-size: x-small; width: 50%; } 
td.subtext a { color: #0076ae; } 

而這裏的JSP:

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 
%><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" 
%><%@ taglib prefix="spring" uri="http://www.springframework.org/tags" 
%><?xml version="1.0" encoding="UTF-8" ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    <title><spring:message code="login.title"/></title> 
    <link rel="stylesheet" type="text/css" href="<c:url value='/css/login.css'/>" /> 
    <script type="text/javascript"> 
    <!-- 
    function clearInput(inp) { 
     if (inp.value === inp.defaultValue) { 
      inp.value = ""; 
     } 
    } 

    function restoreInput(inp) { 
     if (inp.value === "") { 
      inp.value = inp.defaultValue; 
     } 
    } 
    --> 
    </script> 
</head> 
<body> 
    <div class="logo"><img src="<c:url value="/images/logo.png"/>" alt="Logo" /></div> 
    <div class="header"><spring:message code="login.title"/></div> 
    <div class="divider"></div> 
    <form action="j_spring_security_check" method="post"> 
    <table> 
     <tr> 
      <td class="input" colspan="2"><input name="j_username" type="text" onfocus="clearInput(this);" onblur="restoreInput(this);" value="<spring:message code="login.username"/>" /></td> 
     </tr> 
     <tr> 
      <td class="input" colspan="2"><input name="j_password" type="password" onfocus="clearInput(this);" value="<spring:message code="login.password"/>"/></td> 
     </tr> 
     <tr> 
      <td class="submit"><input type="submit" value="<spring:message code="login.loginbutton"/>"/></td> 
      <td class="subtext"><a href="newpass.jsp"><spring:message code="login.newpass"/></a></td> 
     </tr> 
     <c:if test="${not empty param.login_error}"> 
     <tr> 
      <td class="error" colspan="2"><spring:message code="login.error"/></td> 
     </tr> 
     <tr> 
      <td class="errorcode" colspan="2">Code: <c:out value="${SPRING_SECURITY_LAST_EXCEPTION.message}"/></td> 
     </tr> 
     </c:if> 
    </table> 
    </form> 
</body> 
</html> 

回答

0

試試這個。也許工作 -

@font-face { 
    font-family: 'PTSansNarrowRegular'; 
    src: url('PTN57F-webfont.eot'); 
    src: url('PTN57F-webfont.eot?#iefix') format('embedded-opentype'), 
     url('PTN57F-webfont.woff') format('woff'), 
     url('PTN57F-webfont.ttf') format('truetype'), 
     url('PTN57F-webfont.svg#PTSansNarrowRegular') format('svg'); 
    font-weight: normal; 
    font-style: normal; 
    } 

這是從FontSquirrel的CSS的嵌入字體中提取。
希望這會有所幫助。