struts2 jsp页面用标签输出的数据为什么会是unicode编码?

黄焕烁 发布于 2014/07/02 10:59
阅读 187
收藏 0

如题,为什么?

Action:

    private String code;
    private List<Permissionitem> listData;

    public void setCode(String code) {
        this.code = code;
    }
    public List<Permissionitem> getListData() {
        return listData;
    }

    public String itemInfo() throws Exception{
        PermissionitemDao pdao = new PermissionitemDao();
        listData = pdao.selectAll(code);
        return SUCCESS;

    }





jsp:

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<link rel="stylesheet" href="images/jquery.mobile-1.3.2/jquery.mobile-1.3.2.min.css">
<script src="images/jquery-1.8.3.min.js"></script>
<script src="images/jquery.mobile-1.3.2/jquery.mobile-1.3.2.min.js"></script>
<title></title>
</head>

<body>
    <div id="administration" data-role="page">
        <div data-role="header" data-position="fixed">
            <h3></h3>
        </div>
        <div data-role="content">
            <ul data-role="listview" data-inset="true">
                <s:iterator value="listData">
                    <li><a href="#" data-transition="slide"><s:property value="NAME" /></a></li>
                </s:iterator>
            </ul>        
        </div>

..............


结果:

<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<link rel="stylesheet" href="images/jquery.mobile-1.3.2/jquery.mobile-1.3.2.min.css">
<script src="images/jquery-1.8.3.min.js"></script>
<script src="images/jquery.mobile-1.3.2/jquery.mobile-1.3.2.min.js"></script>
<title>办事服务</title>
</head>

<body>
	<div id="administration" data-role="page">
		<div data-role="header" data-position="fixed">
			<h3>行政审批</h3>
		</div>
		<div data-role="content">
			<ul data-role="listview" data-inset="true">
				<li><a href="list_one.html" data-transition="slide">&#32463;&#33829;&#22269;.....</a></li>
..........




其中,<s:property value="NAME" />这里输出的是unicode编码。

数据库里是正常的。不是unicode编码的数据。

加载中
0
王勇鹏
王勇鹏
<s:property value="NAME" escape="false" />   这样试试
返回顶部
顶部