如何在Firebug中编辑POST参数?

bse*_*sel 1 jsf firebug

我在Firefox for Mac上使用Firebug,以便查看有关发送到服务器的请求数据的信息以及从服务器获取的响应.我的Spring + Hibernate + JSF + MySQL应用程序有问题; 即我不能将新对象持久化到数据库中.在Eclipse中,我有一个XHTML文件,如下所示:

<?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"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <h:head>
        <title>JSF Spring Hibernate Integration</title>
        <style type="text/css">
            .tg {
                border-collapse: separate;
                border-spacing: 0;
                border-color: #ccc;
            }

            .tg td {
                font-family: Arial, sans-serif;
                font-size: 14px;
                padding: 10px 5px;
                border-style: solid;
                border-width: 1px;
                overflow: hidden;
                word-break: normal;
                border-color: #ccc;
                color: #333;
                background-color: #fff;
            }

            .tg th {
                font-family: Arial, sans-serif;
                font-size: 14px;
                font-weight: normal;
                padding: 10px 5px;
                border-style: solid;
                border-width: 1px;
                overflow: hidden;
                word-break: normal;
                border-color: #ccc;
                color: #333;
                background-color: #f0f0f0;
            }

            .tg .tg-4eph {
                background-color: #f9f9f9
            }
        </style>
    </h:head>

    <h:body>
        <h1>Add a Person</h1>
        <h:form>
            <table>
                <tr>
                    <td><label>Name</label></td>
                    <td><h:inputText id="Name" value="#{person.name}"></h:inputText>
                    </td>
                </tr>
                <tr>
                    <td><label>Country</label></td>
                    <td><h:inputText id="country" value="#{person.country}"></h:inputText>
                    </td>
                </tr>
                <tr>
                    <td colspan="2"><h:commandButton
                            action="#{personService.addPerson(person)}" value="Add Person"></h:commandButton>
                    </td>
                </tr>

            </table>
        </h:form>

        <br />
        <h3>Persons List</h3>

        <c:if test="${!empty personService.listPersons()}">
            <table class="tg">
                <tr>
                    <th width="80">Person ID</th>
                    <th width="120">Person Name</th>
                    <th width="120">Person Country</th>
                </tr>
                <ui:repeat value="${personService.listPersons()}" var="person">
                    <tr>
                        <td>${person.id}</td>
                        <td>${person.name}</td>
                        <td>${person.country}</td>
                    </tr>
                </ui:repeat>
            </table>
        </c:if>
    </h:body>
</html>
Run Code Online (Sandbox Code Playgroud)

我是Firebug的新手和非常缺乏经验,但在Firebug上检查GET和POST参数时,我看到了一些有趣的东西.点击JSF视图页面上的"添加人员"按钮后; 用户输入名称和国家/地区字段的数据将作为命名的POST参数发送j_idt6:Name,j_idt6:country而不仅仅是"名称"和" 国家/地区".此外,对我来说javax.faces.ViewState似乎有点奇怪.这是它的屏幕截图:

在此输入图像描述

在此输入图像描述

我不是很确定,但我认为这可能导致在我的数据库中持久保存新对象失败.这是我的问题:如何在Firebug上编辑这些参数?如何使它们正常工作?

sam*_*aml 6

Firebug不允许您编辑请求参数,但如果您使用的是Firefox,则内置开发工具允许这样做.

  1. 命中Ctrl+ Alt+ Q在Windows/Linux或Cmd+ Alt+ Q在Mac上才能到网络面板
  2. 重新加载页面
  3. 选择打开侧面板的相关请求
  4. 标题侧面板中,单击编辑并重新发送
  5. 编辑标题
  6. 单击发送