jboss 6 dojo error 415不支持的媒体类型

时间:2016-02-05 17:27:39

标签: rest jboss dojo

我知道这个错误很常见,但是我读过并试过的所有内容都没有用。

  <head>
        <script>

       $(document).ready(function () 
     {

          $(function () 
          {
            $("#CMDCreationDate").datepicker({
                dateFormat: "yy-mm-dd"
              });
          });

    }) ;  

    window.onbeforeunload = confirmExit;
      function confirmExit()
      {
        alert("Alert-- leaving this page.");
       }         


     function numbersonly(myfield, e, dec) {

        //function to check that only numeric values are entered
        var key;
        var keychar;

        if (window.event)
            key = window.event.keyCode;
        else if (e)
            key = e.which;
        else
            return true;

        keychar = String.fromCharCode(key);

        // control keys 
        if ((key == null) || (key == 0) || (key == 8) || (key == 9) || (key == 13) || (key == 27))
            return true;

        // numbers
        else if ((("0123456789").indexOf(keychar) > -1))
            return true;

        // decimal point jump 
        else if (dec && (keychar == ".")) {
            myfield.form.elements[dec].focus();
            return false;
        } else
            return false;
    }


 </script>

</head>   

<body>
    <header>
        <?audit suppress oracle.ide.xml.validation-error?>
        <div class="floatL appTTL">SAMS - EFT Schedule Number Search/Update Screen</div>
        <div id="navWrap">
            <nav class="floatR">
                <ul>
                    <li>
                        <a href="#">Home</a>
                    </li>
                    <li>
                        <a href="#">Search</a>
                    </li>
                    <li>
                        <a href="#">Help</a>
                    </li>
                    <li>
                        <a href="#">Help</a>
                    </li>
                </ul>
            </nav>
        </div>
        <div class="clear"></div>
    </header>

    <main class="mainWrapper">
        <form id="formID" method="POST" action="EFTscreen?action=searchEFT" >  
            <div class="commandcontainer">
              <div id="divBox">
                  <h1 class="formTTL">Please Enter Schedule Number/Contract Year or either Schedule
                      Status/Creation Date value</h1>


                  <label class="labelTTL">Schedule Number</label>
                  <label class="labelTTL3">Contract Year</label>
                  <label class="labelTTL3">Status</label>
                  <label class="labelTTL">Creation Date</label>

                  <br/>
                  <input id="CMDScheduleNumber" name="CMDScheduleNumber" type="number" class="textsmall" maxlength="5"
                         value="${ScheduleNum}" onKeyPress="return numbersonly(this, event)"/>
                  <input id="CMDContractYear" name="CMDContractYear" type="number" class="textsmall" maxlength="4"
                         value="${ContractYear}" onKeyPress="return numbersonly(this, event)"/>
                  <select size="1" id="CMDSchedStatus" name="CMDSchedStatus" class="combosmall">
                       <c:forEach items="${statusList}" var="current">
                          <option value="${current}"
                           <c:if test="${current == Status}"> selected="selected"</c:if>
                                   >${current}</option>
                       </c:forEach>
                  </select> 
                  <input id="CMDCreationDate" name="CMDCreationDate" type="text" class="textsmall"
                         value="${CreationDate}" maxlength="10"/>
                  <br/>
                  <button id="searchEFT" class="btn smBtn">Search</button>

              </div>
                  <div id="divButton">
                      <button id="searchMEFTS" type="submit" formaction="EFTscreen?action=searchMEFTS&screen=mainEFT"
                        class="btn midBtn">Update Schedule Status</button>   

                      <button id="clearMenu" type="submit" formaction="EFTscreen?action=clearMenu"
                        class="btn midBtn Space">Return to Menu</button>   
                  </div>


              <div id="clear"></div>    

            </div>   

            <article class="divBoxdet">
                <fmt:formatNumber var="trdettotal" value="${detResults.getTOTAL_AMOUNT()}" pattern="$##,###,##0.00"/>

                <label class="labelTTLdet floatL">
                    Schedule Number
                    <input id="txtScheduleNumber" type="number" class="textdet" 
                            value="${detResults.getSCHEDULE_NUMBER()}" readonly/>
                </label>
                <label class="labelTTLdet floatL">
                    Contract Year
                    <input id="txtContractYear" type="number" class="textdet" 
                           value="${detResults.getEFT_CONTRACT_YEAR()}" readonly/>
                </label>
                <label class="labelTTLdet floatL">
                    Date Created
                    <input id="txtCreationDate" type="text" class="textdet" 
                               value="${detResults.getCREATION_DATE()}"  readonly/>
                </label>
                <div class="clear"></div>
                <br/>
                <br/>
                <label class="labelTTLdet floatL">
                    Num of Records
                    <input id="txtNumRecords" type="number" class="textdet" 
                            value="${detResults.getNUM_OF_PAY_RECORDS()}" readonly/>
                </label>
                <label class="labelTTLdet floatL">
                    Status
                    <br/>
                    <input id="txtStatus" type="text" class="textdet" 
                            value="${detResults.getSTATUS()}"  maxlength="2"/>
                </label>
                <label class="labelTTLdet floatL">
                    Status Date
                    <input id="txtStatusDate" type="text" class="textdet" 
                            value="${detResults.getSTATUS_DATE()}" maxlength="10"/>
                </label>
                <div class="clear"></div>
                <br/>
                <br/>
                <label class="labelTTLdet floatL">
                    Schedule Total
                    <input id="txtScheduleTotal" 
                           type="text" class="textdet" value="${trdettotal}" readonly/>
                </label>
                <label class="labelTTLdet floatL">
                    Schedule Post Date
                    <input id="txtPostDate" type="text" class="textdet" 
                            value="${detResults.getSCHEDULE_POST_DATE()}" maxlength="10"/>
                </label>
                <label class="labelTTLdet floatL">
                    Reel Number
                    <input id="txtReelNumber" type="text" class="textdet" 
                           value="${detResults.getREEL_NUMBER()}" maxlength="8"/>
                </label>
                <div class="clear"></div>
                <br/>
                <br/>

                   <button id="pullMEFTD" 
                        class="btn largeBtn Space floatL">Update Schedule Payment Status</button>

                <script>
                    $("#searchEFT").mouseup(function ()
                    {

                        var Cmd_Sched_Number = $('#CMDScheduleNumber').val();
                        var schedLen = Cmd_Sched_Number.length;

                        //var Cmd_Contract_Year = document.getElementById("CMDContractYear").value;
                        var Cmd_Contract_Year = $('#CMDContractYear').val();
                        var yearLen = Cmd_Contract_Year.length;

                        //var Cmd_Status = document.getElementById("CMDSchedStatus").value;
                        var Cmd_Status = $('#CMDSchedStatus').val();
                        var statStr = Cmd_Status.replace(/\s/g, "");
                        var statLen = statStr.length;

                        //var Cmd_Creation_Date = document.getElementById("CMDCreationDate").value;
                        var Cmd_Creation_Date = $('#CMDCreationDate').val();
                        var createLen = Cmd_Creation_Date.length;


                     if ((schedLen > 0 && yearLen === 0) || (schedLen === 0 && yearLen > 0))
                        {
                            alert("Schedule Number and EFT Contract Year must be both populated");
                        }
                        ;

                      if ((statLen === 0) && (createLen === 0) && (schedLen === 0) && (yearLen === 0))

                        {
                            var r = confirm("Are you sure you want to pull all EFT schedule numbers?");
                            if (r === false)
                            {
                                alert("Please enter information in any of the command line fields");
                                return false;
                            }
                            else
                            {
                                $('#formID').submit();
                            }
                        } ;

                  });  


                  $("#pullMEFTS").mouseup(function ()
                    {

                        var Det_Sched_Number = $('#txtScheduleNumber').val();
                        var detschedLen = Det_Sched_Number.length;

                        //var Cmd_Contract_Year = document.getElementById("CMDContractYear").value;
                        var Det_Contract_Year = $('#txtContractYear').val();
                        var detyearLen = Det.length;

                        var Det_Status = $('#txtStatus').val();             

                     if (detschedLen > 0)
                        {
                            alert("Schedule Number not found.  Please investigate");
                        }
                        ;

                      if ( holdStatus.matches("RP") ||
                           holdStatus.matches("VP") ||
                           holdStatus.matches("CP") )

                       {
                        alert("User can only update schedule number in NP status");
                       }


                  });    

                </script>

            </article>

       </form>         
    </main>

</body>

在道场

@GET
@Path("test")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
//@Produces(MediaType.TEXT_HTML)
//@Produces(MediaType.TEXT_PLAIN)
public String test() {
    return "{\"name\":\"stewie\"}";
}

它在tomcat 7中运行得非常好。但不是在JBoss 6中。

请注意,我不是使用resteasy,而是使用运动衫。

非常感谢。

1 个答案:

答案 0 :(得分:0)

这一切都归结为:道场很糟糕。如何在官方文档中找到用&#34标记的东西;此时不知道&#34; ?

我的问题的答案是切换到jquery。在这里和那里我必须指定dataType =&#34; json&#34;在通话中就是这样。