Can not read the request.getParameter()
Hello All,
I am trying to read the request.getParameter(). I am setting the default value to 2, if request.getParameter() is empty. If I select some other day, getParameter still shows 2 instead of selected day say 4 or 4. In the debug output, DefaultStartDay is displaying only 2 all the time.
Please let me know what I am doing wrong?.
here are the two codes.
AccountStatus.jsp: this is where I am setting the default value and reading it in ReportStartDay.
<%
String ReportStartDay = request.getParameter("ReportStartDay");
/*if (ReportStartDay == null){
out.println("<br>");
out.println("ReportStartDay: " + ReportStartDay);
out.println("<br>");
}
else
out.println("ReportStartDay Not null: " + ReportStartDay);
*/
%>
<%--set the ReportStartDay default value--%>
<c:set var="DefaultStartDay" value="2"/>
<%-- // set value from request parameter if present--%>
<c:if test="${not empty param.ReportStartDay}">
<c:set var="DefaultStartDay" value="${param.ReportStartDay}"/>
</c:if>
--
In the included page I have following code.
<select name="ReportStartDay" size="1">
<c:forEach var="val" begin="1" end="31" step="1">
<option value="${DefaultStartDay}" ${(DefaultStartDay == val) ? 'selected' : ''} ><c:out value="${val}" />
</c:forEach>
</select>
-

