我在html5上与turkişh角色遇到了麻烦。我在网上研究了相同的问题,并应用了解决方案,但它行不通。我分享我的代码。你能帮我吗?
这是我的allemployees.html文件:
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<link href="<c:url value="../resources/css/bootstrap.css" />" rel="stylesheet">
<link href="<c:url value="../resources/css/bootstrap-theme.css" />" rel="stylesheet">
</head>
<body>
<div class="table-responsive">
<h2>Tüm Çalışanlar</h2>
<table class="table table-bordered">
<div class="row">
<div class="col-md-12">
<tr>
<td class="field-label col-xs-3 active">
<label>TC No</label>
</td>
<td class="field-label col-xs-3 active">
<label>Ad</label>
</td>
<td class="field-label col-xs-3 active">
<label>Soyad</label>
</td>
<td class="field-label col-xs-3 active">
<label>Başlama Tarihi</label>
</td>
<td class="field-label col-xs-3 active">
<label>Maaş</label>
</td>
</tr>
</div>
</div>
<c:forEach items="$(allEmployees)" var="employee">
<tr>
<div class="row">
<div class="col-md-12">
<td>$(employee.citizenNumber)</td>
<td>$(employee.name)</td>
<td>$(employee.surname)</td>
<td>$(employee.joiningDate)</td>
<td>$(employee.salary)</td>
<td>
<a href="<c:url value='/edit-${employee.oid}-employee' />">${employee.oid}</a>
</td>
<td>
<a href="<c:url value='/delete-${employee.oid}-employee' />">delete</a>
</td>
</div>
</div>
</tr>
</c:forEach>
</table>
</div>
<br/>
<a href="<c:url value='/new' />">Yeni Çalışan</a>
</body>
</html>
这是我的JSP文件(我包括HTML(:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="../templates/allemployees.html" %>
您可以在JSTL Core Lib中使用import
与charEncoding
属性。
<c:import url="../templates/allemployees.html" charEncoding="UTF-8" />
编辑
如果将HTML文件放入 Web-Inf/模板中,则应使用映射
XML :
<mvc:resources mapping="/templates/**" location="/WEB-INF/templates/" />
注释:config class
中添加AddResourceHandlers方法@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/templates/**").addResourceLocations("/WEB-INF/templates/");
}
因此,您可以在WEB-INF
文件夹中访问HTML文件:
<c:import url="/templates/allemployees.html" charEncoding="UTF-8" />