日期:2014-05-17  浏览次数:20664 次

求教关于Spring MVC @ResponseBody 问题
头一回使用Spring MVC的@ResponseBody注解,但是无法在前端得到响应。
不知是何原因。代码及配置如下:
前端VIEW: login.jsp
<%--
  Created by IntelliJ IDEA.
  User: BPM
  Date: 2013/8/3
  Time: 下午 2:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=utf-8" language="java" pageEncoding="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"/>
    <script type="text/javascript" src="${pageContext.request.contextPath}/scripts/jquery.js"></script>
    <script type="text/javascript">
        var jq = jQuery.noConflict();
        jq(document).ready(function () {
                    jq("#btnLogin").click(function () {
                                jq.post("${pageContext.request.contextPath}/validateLogin.xhtml",
                                        {
                                            name: jq("#name").val(),
                                            password: jq("#password").val()
                                        },
                                        function (data, status) {