我希望在没有页面刷新的情况下将 bfnsCode选择标记的值更改为servlet。还有taxtCode的值。我该怎么办?这是我的代码......
JSP:
<label style="font-size: 17px;">BIR-Form Number</label><br>
<select name="bfnsCode" id="bfnsCode" class="sel" style="width: 245px; margin-left: 0;">
<option selected="selected" value=""></option>
<c:forEach var="bircode" items="${birtypelist}">
<option value="${bircode.bfnsCode}">${bircode.bfnsCode}</option>
</c:forEach>
</select>
<br><br>
<label style="font-size: 17px;">Tax Type</label><br>
<select name="taxtCode" id="taxtCode" class="sel" style="width: 245px; margin-left: 0;">
<option selected="selected" value=""></option>
<c:forEach var="taxcode" items="${taxtypelist}">
<option value="${taxcode.taxtCode}">${taxcode.taxtCode}</option>
</c:forEach>
</select>
<br><br>
<label style="font-size: 17px;">Account Code</label><br>
<select name="taxtDesc" id="taxtDesc" class="sel" style="width: 245px; margin-left: 0;">
<option selected="selected" value=""></option>
<c:forEach var="taxdesc" items="${taxdesclist}">
<option value="${taxdesc.taxtDesc}">${taxdesc.taxtDesc}</option>
</c:forEach>
</select>
的servlet:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
TblBIRFormNoDAO birdao = DAOFactory.getDaoManager(TblBIRFormNo.class);
List<TblBIRFormNo> birtypelist = birdao.getAllBirFormNumber();
request.setAttribute("birtypelist", birtypelist);
String bir = request.getParameter("bfnsCode");
TblTaxTypeDAO taxdao = DAOFactory.getDaoManager(TblTaxType.class);
if(bir != null){
Debugger.print("BFNSCODE : "+bir);
List<TblTaxType> taxtypelist = null;
taxtypelist = taxdao.findAlltaxtCode(bir);
request.setAttribute("taxtypelist", taxtypelist);
}
String tax = request.getParameter("taxtCode");
TblTaxTypeDAO tdao = DAOFactory.getDaoManager(TblTaxType.class);
if(tax != null){
Debugger.print("TAXCODE : "+tax);
List<TblTaxType> taxdesclist = tdao.findAlltaxtDesc(bir, tax);
request.setAttribute("taxdesclist", taxdesclist);
}
request.getRequestDispatcher("/servlet-test.jsp").forward(request, response);
}
从servlet中的这段代码中,请求getParameter给出一个空值。当用户在下拉列表中选择一个值时,如何获得正确的值?
P.S
第二次下拉是基于第一次和第三次下拉是基于第二次因此第二次和第三次下拉当前是空的,因为我没有得到参数bfnsCode(第一次下拉)的值。请帮帮我,我非常需要这个。