weixin_33716941 2015-06-01 07:19 采纳率: 0%
浏览 1428

POST请求参数丢失

Client Code

function Call() 
{
    var value = $('input[name=form]:checked').val();
    if (typeof(value)=='undefined')
    {
        alert('Select One Record');
        return false;
    }
    else
    {
        $("#bean\\.id").val(value.split("@@")[0]);
        var id = $("#bean\\.id").val();
        $.post("search.do", {'id': id},
        function(data){

        });
    }
}
<s:hidden name="bean.id" id="bean.id" />
<s:iterator var="form" value="#request.list" status="offset">
<input type="radio" name="form" value="${form.id}@@${form.status}"></input>
</s:iterator>

Server Code Struts2 config XML

<action name="search" class="<action name>" method="search">
    <result name="success" type="json">
        <param name="includeProperties">returnString</param>
    </result>
</action>

Java Action Function

public String search() throws Exception
{
    String id_server = context.getRequest().getParameter("id");
    // Do some stuff    
    return SUCCESS;
}

Using Websphere 8.5.0.4.

It seems that sometimes the request parameter is not existed.
(id_server=null)
Does anyone have any idea why this happen?
I have other places using very similar code without problem.

I have failed to re-produce the problem. But my testing environment is Websphere 8.5.5.4.
I am not sure if this is the Websphere problem as the problem area is using 8.5.0.4 (Production environment).

Does anyone have any idea with this problem? Mainly I want to know the reason as I may need to explain.
Many Thanks

  • 写回答

1条回答 默认 最新

  • weixin_33736048 2015-06-01 07:54
    关注

    By default servers put restriction on size of post request like in tomcat by default it is 2mb. If post request size exceeds this size, request parameters are discarded by server. You may check https://serverfault.com/questions/311610/how-to-increase-the-size-of-http-post-request-in-websphere to change it for websphere.

    评论

报告相同问题?