나는 내 첫 번째 드롭 다운 목록 id = "bfnsCode"을 가지고 있습니다. 다음 번 드롭 다운 목록에서 그 값을 사용하고 싶습니다. id = "taxtCode"는 새로운 세트를 보여줄 수 있습니다. 첫 번째 드롭 다운을 기준으로 한 값입니다. 당신이 볼 수 있듯이, 나는 드롭 다운 세금에 request.getParameter ("bfnsCode")를 사용하여 값을 호출하지만 나에게 null 값을 제공첫 번째 드롭 다운 목록에서 값을 얻으십시오
<div class="BIR" style="display: none;">
<div>
<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>
<%
TblBIRFormNoDAO birdao = DAOFactory.getDaoManager(TblBIRFormNo.class);
HttpSession live = request.getSession(true);
TblUserInformation user = (TblUserInformation) live.getAttribute("user");
List<TblBIRFormNo> birtypelist = null;
if(user.getRcoCode() != null){
birtypelist =birdao.getAllBirFormNumber();
}else{
}
String birtypeoptions = "";
if(birtypelist!=null) {
if(birtypelist.size()>0) {
for(int i=0; i<birtypelist.size();i++) {
TblBIRFormNo taxtype = (TblBIRFormNo) birtypelist.get(i);
birtypeoptions += "<option value='"+taxtype.getBfnsCode()+"'>"+taxtype.getBfnsCode()+"</option>";
taxtype = null;
}
}
}
birdao = null;
birtypelist = null;
%>
<%=birtypeoptions%>
</select>
<br><br>
<label style="font-size: 17px;">Tax Type</label><br>
<select name="taxtCode" id="taxtCode" class="sel" style="margin-left: 0;">
<option selected="selected" value=""></option>
<%
TblTaxTypeDAO taxdao = DAOFactory.getDaoManager(TblTaxType.class);
List<TblTaxType> taxtypelist = null;
String tax = request.getParameter("bfnsCode");
Debugger.print("test : "+tax);
if(tax != null){
taxtypelist = taxdao.findAlltaxtCode(tax);
}else{
taxtypelist = taxdao.getAllTaxTypes();
}
String taxtypeoptions = "";
if(taxtypelist!=null) {
if(taxtypelist.size()>0) {
for(int i=0; i<taxtypelist.size();i++) {
TblTaxType taxtype = (TblTaxType) taxtypelist.get(i);
taxtypeoptions += "<option value='"+taxtype.getTaxtCode()+"'>"+taxtype.getTaxtCode()+"</option>";
taxtype = null;
}
}
}
taxdao = null;
taxtypelist = null;
%>
<%=taxtypeoptions%>
</select>
: 여기 내 코드입니다.
ListBIRFormNo.java (C에 대한 서블릿 : 대해 forEach)
public class ListBIRFormNo extends HttpServlet {
private static final long serialVersionUID = 1L;
private List<TblBIRFormNo> birtypelist;
public List<TblBIRFormNo> getTblBIRFormNo() {
return birtypelist;
}
public void setTblBIRFormNo(List<TblBIRFormNo> birtypelist) {
this.birtypelist = birtypelist;
}
private HttpServletRequest request;
public void setServletRequest(HttpServletRequest request){
this.request = request;
}
public String execute(){
Debugger.border();
try{
TblBIRFormNoDAO birdao = DAOFactory.getDaoManager(TblBIRFormNo.class);
HttpSession live = request.getSession(true);
TblUserInformation user = (TblUserInformation) live.getAttribute("user");
if(user.getRcoCode() != null){
birtypelist =birdao.getAllBirFormNumber();
}else{
//no-op
}
//expose 'birtypelist' as an attribute
request.setAttribute("birtypelist", birtypelist);
}catch(Exception e){
e.printStackTrace();
Debugger.print(" EXCEPTION :"+e.getStackTrace());
Debugger.endDebug(this.getClass().toString());
Debugger.border();
}
Debugger.border();
return null;
}
}
서블릿을 사용하고 요청 속성에 매개 변수를 저장하여 다음보기 JSP에서 렌더링하십시오. –
단일 양식만으로도 가능합니까? 이들은 양식 안에있는 div들뿐입니다. – RMsplace