1600 PMP mock questions 1400 CAPM mock questions 800 SCJP 6 mock questions 600 OCAJP 7 mock questions 590 OCPJP 7 mock questions 556 SCWCD 5 mock questions 500 OCEJWCD 6 mock questions pdfDownload (java,struts, hibernet etc)
 

Recent Questions

!!! JSP Frequently Asked Questions !!!

Q.How to create a drop down list in jsp?

!!!Answer!!!- From Technical Expert


This is the code to display drop down list in jsp.
List medList = DAO.getallMedium(); // this method retun list of Medium objects.
medList list contains list of Medium objects.

Java :
bean class.
public class Medium {
    int medId;
    String medName;

    /**
     * @return Returns the medId.
     */
    public int getMedId() {
        return medId;
    }
    /**
     * @param medId The medId to set.
     */
    public void setMedId(int medId) {
        this.medId = medId;
    }
    /**
     * @return Returns the medName.
     */
    public String getMedName() {
        return medName;
    }
    /**
     * @param medName The medName to set.
     */
    public void setMedName(String medName) {
        this.medName = medName;
    }
}

DAO Clas to retrive mediums in data base.
public static List getMediums(){
        PreparedStatement pStmt = null;
     Connection conn = null;
     boolean success = false;
     ResultSet rs = null;
     List medList = new ArrayList();
    
     try{
         conn = getConnection();
         
         String sql = " select * from MEDIUM ";
         pStmt = conn.prepareStatement(sql);
                  
         rs = pStmt.executeQuery();
         while(rs.next()){
             Medium med = new Medium();
             med.setMedId(rs.getInt("MED_ID"));
             med.setMedName(rs.getString("MEDIUM_NAME"));
             medList.add(med);
             }
        
        
        
     }catch(Exception e){
         e.printStackTrace();
         
     }finally{
         closeConnectionProp(conn,pStmt,rs);
     }
        
     return medList;
    
    }

JSP :

<select name="Medium" id="medium" >
<option value="0">Choose A Medium</option>

<%
     for(int i=0; i<medList.size();i++){
         Medium med = (Medium)medList.get(i);
     %>
<option value="<%=med.getMedId()%>"><%=med.getMedName()%></option>
<%}%>
</select>


Servlet :
Retrive the selection from jsp
String mediumId =(String)request.getParameter("medium");

Answered By : null Replied Date : Feb 3 2014
Answer :


Answered By : null Replied Date : Feb 2 2014
Answer :


Answered By : null Replied Date : Feb 2 2014
Answer :


Answered By : null Replied Date : Jan 6 2014
Answer :


Answered By : null Replied Date : Dec 29 2013
Answer :


Answered By : null Replied Date : Dec 20 2013
Answer :


Answered By : null Replied Date : Nov 22 2013
Answer :


Answered By : null Replied Date : Nov 6 2013
Answer :


Answered By : null Replied Date : Nov 3 2013
Answer :


Answered By : null Replied Date : Nov 2 2013
Answer :


Answered By : null Replied Date : Nov 1 2013
Answer :


Answered By : null Replied Date : Oct 31 2013
Answer :


Answered By : null Replied Date : Oct 23 2013
Answer :


Answered By : null Replied Date : Oct 22 2013
Answer :


Answered By : null Replied Date : Oct 17 2013
Answer :


Answered By : null Replied Date : Sep 30 2013
Answer :


Answered By : null Replied Date : Feb 7 2014
Answer :


Answered By : null Replied Date : Feb 16 2014
Answer :


Answered By : null Replied Date : Mar 11 2014
Answer :


Answered By : null Replied Date : Mar 24 2014
Answer :


Answered By : null Replied Date : Apr 10 2014
Answer :


Answered By : null Replied Date : Apr 27 2014
Answer :


Answered By : null Replied Date : Apr 28 2014
Answer :


Answered By : null Replied Date : May 13 2014
Answer :


Answered By : null Replied Date : May 16 2014
Answer :


Answered By : null Replied Date : Jun 5 2014
Answer :


Answered By : null Replied Date : Jul 3 2014
Answer :


Answered By : null Replied Date : Jul 4 2014
Answer :


Answered By : null Replied Date : Aug 2 2014
Answer :


Answered By : null Replied Date : Aug 21 2014
Answer :


Answered By : null Replied Date : Oct 2 2014
Answer :


Answered By : null Replied Date : Nov 3 2014
Answer :


Answered By : null Replied Date : Nov 3 2014
Answer :


Answered By : null Replied Date : Nov 3 2014
Answer :


Answered By : null Replied Date : Nov 4 2014
Answer :


Answered By : null Replied Date : Nov 4 2014
Answer :


Answered By : null Replied Date : Nov 13 2014
Answer :


Answered By : null Replied Date : Nov 21 2014
Answer :


Answered By : null Replied Date : Dec 10 2014
Answer :


Answered By : null Replied Date : Jan 23 2015
Answer :


Answered By : null Replied Date : Mar 13 2015
Answer :


Answered By : null Replied Date : Apr 16 2015
Answer :


Answered By : null Replied Date : Jun 11 2015
Answer :


Answered By : null Replied Date : Jun 27 2015
Answer :


Answered By : null Replied Date : Jul 1 2015
Answer :


Answered By : null Replied Date : Jul 3 2015
Answer :


Answered By : null Replied Date : Aug 6 2015
Answer :


Answered By : null Replied Date : Aug 10 2015
Answer :


Answered By : null Replied Date : Sep 25 2015
Answer :


Answered By : null Replied Date : Oct 7 2015
Answer :


Answered By : null Replied Date : Oct 10 2015
Answer :


Answered By : null Replied Date : Oct 15 2015
Answer :


Answered By : null Replied Date : Nov 12 2015
Answer :


Answered By : null Replied Date : Dec 27 2015
Answer :


Answered By : null Replied Date : Dec 29 2015
Answer :


Answered By : null Replied Date : Jan 25 2016
Answer :


Answered By : null Replied Date : Jan 27 2016
Answer :


Answered By : null Replied Date : Jan 30 2016
Answer :


Answered By : null Replied Date : Feb 2 2016
Answer :


Answered By : null Replied Date : Feb 23 2016
Answer :


Answered By : null Replied Date : May 7 2016
Answer :


Answered By : null Replied Date : May 9 2016
Answer :


Answered By : null Replied Date : May 18 2016
Answer :


Answered By : null Replied Date : Jun 14 2016
Answer :


Answered By : null Replied Date : Jun 17 2016
Answer :


Answered By : null Replied Date : Jun 23 2016
Answer :


Answered By : null Replied Date : Jul 7 2016
Answer :


Answered By : null Replied Date : Sep 29 2016
Answer :


Answered By : null Replied Date : Sep 30 2016
Answer :


Answered By : null Replied Date : Sep 30 2016
Answer :


Answered By : null Replied Date : Sep 30 2016
Answer :


Answered By : null Replied Date : Sep 30 2016
Answer :


Answered By : null Replied Date : Sep 30 2016
Answer :


Answered By : null Replied Date : Oct 28 2016
Answer :


Answered By : null Replied Date : Nov 17 2016
Answer :


Answered By : null Replied Date : Feb 16 2017
Answer :


Answered By : null Replied Date : Feb 16 2017
Answer :


Answered By : null Replied Date : Apr 14 2017
Answer :


Answered By : null Replied Date : Jun 15 2017
Answer :


 

You can also contribute to this answer:

Your Name:
Answer:

 
Ask Question and get answer from Expert.
View Answers List from Expert.

Reviews and Comments


PMP, CAPM, PMI is a registered certification mark of the Project Management Institute, Inc

Copyright © www.techfaq360.com 2016


About US | Contact US | Privacy Policy | Terms and Conditions  | Website disclaimer  | Cancellation and Refund Policy  | Shipping & Delivery Policy