'How can I get source name from JSP file AND make it to img src?
I'm making Online bookstore ShoppingMall with MVC not Spring.
I got DAO file and Servlet file and JSP file. ProductRegisterAction.java(servelt) / ProductDAO.java / productRegister.jsp
I want to register image but I have problem. My images are in folder '/images/CATEGORYNAME/' (not CATEGORYNAME, humanities, and so etc. See image please)
Anyway, I got CATEGORYNAME from JSP file form with select option. how can i give this values to Servlet file?
This is servlet file.
CategoryVO catevo = new CategoryVO();
String cate_name = mtrequest.getParameter("cate_name");
catevo.setCate_name(cate_name);
cate_name = mtrequest.getParameter("cate_name");
ServletContext svlCtx = session.getServletContext();
String uploadFileDir = svlCtx.getRealPath("/images/product"+cate_name);
And this is JSP file.
<form name="prodInputFrm"
action="<%= request.getContextPath()%>/product/admin/productRegister.book"
method="POST"
enctype="multipart/form-data">
<table id="tblProdInput" style="width: 80%;">
...
<tr>
<td width="25%" class="prodInputName" style="padding-top: 10px;">CATEGORY</td>
<td width="75%" align="left" style="padding-top: 10px;">
<select name="fk_cate_num" class="infoData">
<option value="">SELECT CATEGORY</option>
<c:forEach var="map" items="${requestScope.categoryList}">
<option value="${map.pk_cate_num}">${map.cate_name}</option>
</c:forEach>
</select>
</td>
</tr>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
