Struts2 will not display the query parameter in the Integer action field

Ok, I'm losing my mind here. It should be trivial, but I was stuck with this all day. This is the setting:

jsp form:

<s:form action="update-po-numbers" method="GET">
        <h3>PO numbers</h3>

        <s:hidden name="programId"/>

        USD: <s:textfield name="poNumUSD.paramValue" />
        EUR: <s:textfield name="poNumEUR.paramValue" />

        <s:submit value="Update PO numbers" />
</s:form>

struts.xml: (the default interceptor stack is used)

<action name="update-po-numbers" class="UpdatePONumbersAction">
        <result name="success">success.jsp</result>
</action>

UpdatePONumbersAction.java:

public class UpdatePONumbersAction extends BaseAction {

        private Integer                 programId;
        private InvoiceParameterVO      poNumUSD;
        private InvoiceParameterVO      poNumEUR;

        @Override
        public String execute () throws Exception {

                InvoiceManager.updatePoNums(programId, poNumUSD, poNumEUR);

                return Action.SUCCESS;
        }

        public Integer getProgramId () {
                return programId;
        }

        public void setProgramId ( Integer programId ) {
                this.programId = programId;
        }

        public InvoiceParameterVO getPoNumUSD () {
                return poNumUSD;
        }

        public void setPoNumUSD ( InvoiceParameterVO poNumUSD ) {
                this.poNumUSD = poNumUSD;
        }

        public InvoiceParameterVO getPoNumEUR () {
                return poNumEUR;
        }

        public void setPoNumEUR ( InvoiceParameterVO poNumEUR ) {
                this.poNumEUR = poNumEUR;
        }
}

The form is previously populated with values. I see from Chrome dev tools that all request parameters are sent as expected and are not null. Inside the action, poNumUSD.paramValue and poNumEUR.paramValue (which are strings) are set just fine. However, programId is set to null. I can get programId"manually" as a String using:

ServletActionContext.getRequest().getParam(paramName))

. ? , , , .

+3
1

programId form.jsp

<s:hidden name="programId" value="1" />

<s:hidden name="programId" value="%{programId}" />

<input type="hidden" id="programId" name="programId" value="<%=request.getParameter("programId")%>" />
+2

All Articles