• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP Questions;

 
Ikasari Widiyanto
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to ask how if we click the add button for example then another table pop up? I have the code but the table can not appear.

<tr bgcolor="#FFFFFF">
<td width="197" height="42"><span class="style6">Request Type</span></td>
<td width="336"><span class="style6">
<select name="requestType" size="1" id="requestType">
<%
conn = db.getConnection();
stmt = conn.createStatement();
sql="select code from requesttype order by code";
rs=stmt.executeQuery(sql);
while(rs.next()){
%>
<option><%=rs.getString("code")%></option>
<%}
rs.close();
stmt.close();
conn.close();
typeSelected = request.getParameter("requestType");
System.out.println("hello1:" + typeSelected);
%>
</select>
</span></td>

then the code:

<%if (typeSelected!=null)
{
if (typeSelected.equals("Purchase Requisition"))
{
%>
<table width="836" border="1">
<tr>
<td width="144"><p class="style6">Description:</p>
<p class="style6">
<input name="pdesc" type="text" id="pdesc4">
</p></td>
<td width="80"><p class="style6">Category:</p>
<p class="style6">
<select name="cat" size="1" id = "cat">
<%
conn = db.getConnection();
stmt = conn.createStatement();
sql="select category from suppliercategory order by category";
rs=stmt.executeQuery(sql);
while(rs.next()){
%>
<option value="<%=rs.getString("category")%>"><%=rs.getString("category")%></option>
<%}
rs.close();
stmt.close();
conn.close();
%>
</select>
</p></td>
<td width="144"><p class="style6">Quantity:</p>
<p class="style6">
<input name="pQn" type="text" id="pQn4" maxlength="10">
</p></td>
<td width="144"><p class="style6">Cost: </p>
<p class="style6">
<input name="pCost" type="text" id="pCost4" value="">
</p></td>
<td width="290"><p class="style6">Recommended Supplier:</p>
<p class="style6">
<select name="sup" size = "1" id="sup">
<%
if (request.getParameter("cat")!=null)
{
conn = db.getConnection();
stmt = conn.createStatement();
sql="select scatid from suppliercategory where category = '" + request.getParameter("cat") + "'";
rs=stmt.executeQuery(sql);
while(rs.next()){
scatid = rs.getString("scatid");
}
sql="select suppliername from supplier where scatid = "+scatid+"";
rs=stmt.executeQuery(sql);
while(rs.next()){
%>
<option value="<%=rs.getString("suppliername")%>"><%=rs.getString("suppliername")%></option>
<%}
}
rs.close();
stmt.close();
conn.close();
%>
</select>
</p></td>
</tr>
</table>

Do you know where is the bug?
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
your problem is not clear !!! Can you explain it in detail
 
Ikasari Widiyanto
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hehe..
I mean how to get the user choice from the drop down box.. any sample code?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!