I want to dynamically fetch or get data from database and populate the select box. This is my code:
    <form action="addchangerequest" method="post">
        <select name="type">
            <option value="Non-Sap">Non-Sap</option>
            <option value="Sap">Sap</option>
        </select>
        <select name="assettriggered">
            ** I want to populate these option values upon making a selection to the first select box. These option will be the data coming from the database**
        </select>
    </form>
This is my method class.
    public List sortDeployed(String userID)
{
    List deployedlist = new ArrayList();
    try
    {
        PreparedStatement pstmt = conn.prepareStatement(SORT_ID);
        pstmt.setString(1, userID);
        ResultSet rs = pstmt.executeQuery();
        while(rs.next())
        {
            StoreAssetBean storeAssetBean = new StoreAssetBean();
            storeAssetBean.setDeployedID(rs.getInt("AssetDeployed_ID"));
            storeAssetBean.setName(rs.getString("Asset_Name"));
            storeAssetBean.setMmoID(rs.getString("UserDivision_ID"));
            storeAssetBean.setDepartment(rs.getString("User_Department"));
            storeAssetBean.setDepType(rs.getString("AssetDeployed_Type"));
            storeAssetBean.setDeployedDateTime(rs.getString("AssetDeployed_DateTime"));
            deployedlist.add(storeAssetBean);
        }
    }
    catch(SQLException e)
    {
        System.out.println(e);
    }
    return deployedlist;
}
I want the AssetDeployed_Type data must be imported to the select box named "assettriggered". Im using MVC Model 2 JSP Servlet. I've search about ajax, but i have no experience in implementing it. I want it to be dynamic data fetch when I select value in the first select box. Please help me guys, thank you in advance!!
 
    