문제

JSP Code:

   <s:iterator value="#currentRequisitionGroup.plFldWrap.allPFields" var="pMap" status="hStatus">
    <s:iterator value="#pMap.value.paramMdlList" var="paramModel" status="fStat">
    <li>
     <label>
        <s:property value="#paramModel.parameterName" />

     </label> 
    <s:set var="cEdit" value="%{#paramModel.isEditable}"> </s:set>  

    <s:if test="%{#cEdit == true}">
        <s:textfield id="paramId_%{#paramModel.parameterId}" name="rqPGPrmMdl.rqGrp[%     {#cGStat.index}].plFldWrap.allPFields['%{(#pMap.key)}'].paramMdlList[%{#fStat.index}].prmValue"/>
    </s:if>
    <s:else>
         <s:textfield id="paramId_%{#paramModel.parameterId}" name="rqPGPrmMdl.rqGrp[%  {#cGStat.index}].plFldWrap.allPFields['%{(#pMap.key)}'].paramMdlList[%{#fStat.index}].prmValue" readonly="true"/>
    </s:else>    



</li> 
<s:hidden id="prmId_%{#paramModel.parameterId}" name="rqPGPrmMdl.rqGrp[%{#cGStat.index}].plFldWrap.allPFields['%{(#pMap.key)}'].paramMdlList[%{#fStat.index}].parameterId"></s:hidden> 
<s:hidden id="paramName_%{#paramModel.parameterId}" name="rqPGPrmMdl.rqGrp[%{#cGStat.index}].plFldWrap.allPFields['%{(#pMap.key)}'].paramMdlList[%{#fStat.index}].parameterName"></s:hidden>
<s:hidden id="pGId_%{#paramModel.parameterId}"  name="rqPGPrmMdl.rqGrp[%{#cGStat.index}].plFldWrap.allPFields['%{(#pMap.key)}'].paramMdlList[%{#fStat.index}].parameterGroupId"></s:hidden> 
<s:hidden id="seqNo_%{#paramModel.parameterId}" name="rqPGPrmMdl.rqGrp[%{#cGStat.index}].plFldWrap.allPFields['%{(#pMap.key)}'].paramMdlList[%{#fStat.index}].sequenceNumber"></s:hidden>

</s:iterator>
    </s:iterator>

The problem is that some values do not appear in action. Investigation till now indicates that, if the corresponding html input has space in the key of allPFields, that value doesn't appear in action. <input id="prmId_30" type="hidden" value="30" name="rqPGPrmMdl.rqGrp[1].plFldWrap.allPFields['Emp System'].paramMdlList[0].parameterId">

However, if the corresponding html input has no space in the key of allPFields, that value appears in action. <input id="prmId_46" type="hidden" value="30" name="rqPGPrmMdl.rqGrp[1].plFldWrap.allPFields['Emp'].paramMdlList[0].parameterId">

Here is what the logs say: xwork2.interceptor.ParametersInterceptor - Parameter [rqPGPrmMdl.rqGrp[1].plFldWrap.allPFields['Emp System'].paramMdlList[0].parameterId] **didn't match acceptedPattern pattern!**

도움이 되었습니까?

해결책

This is happening because white spaces are not accepted in parameter names. You can change acceptParamNames parameter of the ParametersInterceptor, BUT as the documentation states

acceptParamNames - a comma delimited list of regular expressions to describe a whitelist of accepted parameter names. Don't change the default unless you know what you are doing in terms of security implications

So I suggest you to get rid of white spaces in parameters names.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top