I understood your suggestion. But for knowledge sake.... i have to pass the field hidden else the fields or parameters will not be available in the java class. As I am calling request.getParameters method.... it is expecting some parameters.
Is it so that all the form fields/parameters are available to the corresponding class file by default in ofbiz? Pls clarify. On Tue, May 3, 2022 at 8:18 PM Scott Gray <[email protected]> wrote: > > Your form contains duplicate inputs for each of your field names, one > hidden for each and one visible (date, number etc.). > > When this is submitted, the duplicates will be combined into an array of > values for the given parameter name. > > ServletRequest#getParameter will only return the FIRST value in the array > (i.e. your empty hidden inputs). > > See the servlet spec for more info, section 3.1: > https://javaee.github.io/servlet-spec/downloads/servlet-4.0/servlet-4_0_FINAL.pdf > > Regards > Scott > > On Thu, 28 Apr 2022 at 04:49, Avijit Bose <[email protected]> wrote: > > > My code is as follows: > > > > “finalizeLC.ftl” > > -------------------- > > <div class="screenlet-body"> > > <form method="post" action="<@ofbizUrl>finalizeLCUpdate</@ofbizUrl>" > > name="finalizeLCUpdate" id="finalizeLCUpdate"> > > > > <input type="hidden" name="LcReceiveDate" value=""> > > <input type="hidden" name="countDownDays" value=""> > > <input type="hidden" name="remarks" value=""> > > > > > > <table width="100%" cellspacing="2"> > > <tbody> > > <tr> > > <td align="right"> > > </td> > > <td align="right"> > > <label > > for="LcReceiveDate">${uiLabelMap.LcReceiveDate} </label> > > </td> > > <td colspan="4"> > > <input type="date" id="LcReceiveDate" name="LcReceiveDate" > > style="background-color:#D6F2FF" value="${LcReceiveDate!}" required> > > </td> > > <td></td> > > </tr> > > <tr> > > <td align="right"> > > </td> > > <td align="right"> > > <label > > for="countDownDays">${uiLabelMap.countDownDays} </label> > > </td> > > <td colspan="4"> > > <input type="number" id="countDownDays" > > name="countDownDays" style="background-color:#D6F2FF" > > value="${countDownDays!}" required> > > </td> > > <td></td> > > </tr> > > <tr> > > <td align="right"> > > </td> > > <td align="right"> > > <label > > for="remarks">${uiLabelMap.remarks} </label> > > </td> > > <td colspan="4"> > > <input type="text" id="remarks" > > value="${remarks!}" name="remarks" size="100" > > style="background-color:#D6F2FF" required> > > </td> > > <td></td> > > </tr> > > </tbody> > > </table> > > > > <table width="100%" cellspacing="2"> > > <tbody> > > <tr> > > <td align="right"> > > </td> > > <td align="right"> > > > > </td> > > <td> > > > > <button type="submit" form="finalizeLCUpdate" > > value="Submit">${uiLabelMap.finalizeLC}</button> > > </td> > > <td></td> > > </tr> > > </tbody> > > </table> > > </form> > > </div> > > > > > > “UpdateLCServices.java and method finalizeLCUpdate” > > > > ------------------------------------------------------------------------------------ > > public static String finalizeLCUpdate(HttpServletRequest > > request, HttpServletResponse response) { > > > > Delegator delegator = (Delegator) > > request.getAttribute("delegator"); > > > > String LcReceiveDate = > > request.getParameter("LcReceiveDate").trim(); > > String countDownDays = > > request.getParameter("countDownDays").trim(); > > String remarks = > > request.getParameter("remarks").trim(); > > > > Debug.logInfo("=======LcReceiveDate=========", > > LcReceiveDate); > > Debug.logInfo("=======countDownDays=========", > > countDownDays); > > Debug.logInfo("=======remarks=========", remarks); > > } > > > > > > “Controller” > > ---------------- > > <request-map uri="finalizeLCUpdate"> > > <security https="true" auth="true"/> > > <event type="java" path="com.akm.exim.events.UpdateLCServices" > > invoke="finalizeLCUpdate"/> > > <response name="success" type="view" value="exportHome"/> > > </request-map> > > > > > > I am passing hidden values from the “finalizeLC.ftl” file and unable > > to retrieve data in the java class “UpdateLCServices.java and method > > finalizeLCUpdate”. Debug.loginfo showing null values. > > > > Pls help in how to pass form parameter values to ftl java class in Ofbiz. > > > > Regards > > Avijit Bose > >
