I have this in my jsp file which displays several drops downs(dynamic) when the JSP is opened. The AssetName is Unique Identifier for the dropdowns. I want to capture the changed values in the dropdown (if user changes any) and send it to a servlet code where I need to call a method to update the changed value for the Asset Name. I am newbie to JSP/Servlets. I have here both the JSP code and Servlet code. Can someone correct it and post it here as I have trouble handling the values in the Servlet code. Thanks a bunch.
JsP:
int br = 1;
for (int i = 0; i < size ; i++)
{
ExportAsset extAsset = exportAsset;
if(extAsset!=null)
{
%>
<TR>
<TD align="center">
//This is the Unique identifier for the dropdowns which
//should be used by the servlet when update
<%= extAsset.getAssetName()%>
</TD>
</TR>
<SELECT name="exportType">
<OPTION value="NS"><%= extAsset.getExportAssetTypeName()%>
<%
ExportAssetTypeList eatList = (ExportAssetTypeList) session.getAttribute("ExportAssetTypeList"
for(int j = 0 ; j < eatList.size(); j ++)
{
%>
<OPTION value="<%=eat.getId()%>"><%=eat.getName() + " (" + eat.getNumAssignsAllowed() +""%>
<%
}
%>
</SELECT>
<%=(br%5 == 0)?"</TR><TR>":""%>
<%
br++;
}
}
%>
-------------------------------------------------
Servlet:
protected String finishTypeAssign(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession(false);
ExportAssetManager extAssMgr = new ExportAssetManager();
String selectedMediaType = request.getParameter("selectedMediaType"
String uoiIdParent = request.getParameter("uoiIdParent"
ExportAsset[] exportAsset = extAssMgr.getSelectedExportAssets(uoiIdParent, selectedMediaType);
for(int i = 0 ; i < exportAsset.length ;i ++)
{
ExportAsset expasst = exportAsset;
//Please let me know how to handle the changed values for the dropdown here
String newDropDownValue = request.getParameter("exportType"
if(newExpAssetTypeName!=null)
{
expasst.setName(newDropDownValue);
exportAsset = expasst;
}
}
extAssMgr.updateExportAssets(uoiIdParent, selectedMediaType, exportAsset);
return "SUCCESS";
}
JsP:
int br = 1;
for (int i = 0; i < size ; i++)
{
ExportAsset extAsset = exportAsset;
if(extAsset!=null)
{
%>
<TR>
<TD align="center">
//This is the Unique identifier for the dropdowns which
//should be used by the servlet when update
<%= extAsset.getAssetName()%>
</TD>
</TR>
<SELECT name="exportType">
<OPTION value="NS"><%= extAsset.getExportAssetTypeName()%>
<%
ExportAssetTypeList eatList = (ExportAssetTypeList) session.getAttribute("ExportAssetTypeList"
for(int j = 0 ; j < eatList.size(); j ++)
{
%>
<OPTION value="<%=eat.getId()%>"><%=eat.getName() + " (" + eat.getNumAssignsAllowed() +""%>
<%
}
%>
</SELECT>
<%=(br%5 == 0)?"</TR><TR>":""%>
<%
br++;
}
}
%>
-------------------------------------------------
Servlet:
protected String finishTypeAssign(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession(false);
ExportAssetManager extAssMgr = new ExportAssetManager();
String selectedMediaType = request.getParameter("selectedMediaType"
String uoiIdParent = request.getParameter("uoiIdParent"
ExportAsset[] exportAsset = extAssMgr.getSelectedExportAssets(uoiIdParent, selectedMediaType);
for(int i = 0 ; i < exportAsset.length ;i ++)
{
ExportAsset expasst = exportAsset;
//Please let me know how to handle the changed values for the dropdown here
String newDropDownValue = request.getParameter("exportType"
if(newExpAssetTypeName!=null)
{
expasst.setName(newDropDownValue);
exportAsset = expasst;
}
}
extAssMgr.updateExportAssets(uoiIdParent, selectedMediaType, exportAsset);
return "SUCCESS";
}