How can i display the result on the same search page in a jsp page?

I have a text box with a submit button to the left. Once the user enter the a number in the search field my select query executes.

My question is how can i display the reult on the same page? I have been able to display results on the same page but my table headers are also displayed at the same time while user is trying to enter the item number.

i tried using <c:if> but its not wokring, Any help?

One last question is it possible to do something like this while displaying my list also?

http://www.compzia.org/pravinth/demo.htm 

Thank You
<%@ include file="/WEB-INF/jsp/include.jsp" %>
<html>
<head>
<title>VDP QOH UPDATE</title>
</head>
<body>
<spring:bind path="quantityOnHand">
  <FONT color="red">
<B><c:out value="${status.errorMessage}"/></B>
  </FONT>
</spring:bind>
<P>
<FORM name="quantityOnHandForm" method="POST" action = ''>
<CENTER>
 
<table BORDER=0  CELLSPACING=0 CELLPADDING=5 WIDTH=600>
 
    <tr>
		<td COLSPAN=2 BGCOLOR="#003366"><P ALIGN="CENTER"><B><FONT COLOR="#FFFFFF" SIZE="2" FACE="Arial,Helvetica,Univers,Zurich BT">Query</FONT></B>
		</td>
	</tr>
	<tr>
		<td WIDTH=215 BGCOLOR="#336699"><P ALIGN="RIGHT">
<B>
		       <FONT COLOR="#FFFFFF" SIZE="-1" FACE="Arial,Helvetica,Univers,Zurich BT">
				Item No:
			   </FONT>
</B>
		</td>
		<td ALIGN=LEFT><spring:bind path="quantityOnHand.itemNumber">
		        <input type="text" maxlength="30" size="10" name='<c:out value="${status.expression}"/>' value='<c:out value="${status.
					value}"/>'>
    <td><font color="red"><c:out value="${status.errorMessage}" /></font>    </td>
  	</spring:bind>
 
		</td>
		
	</tr>
	
 
    <tr>
	   <td BGCOLOR="#336699" WIDTH=215> </td>
	   <td>
		  <input type="submit" name="Submit" value="Submit" >
	  </td>
   </tr>
	
    
</table>
 
</center>
</form>
<table BORDER=0  CELLSPACING=0 CELLPADDING=5 WIDTH=600>
 
    <tr>
		<td COLSPAN=2 BGCOLOR="#003366"><P ALIGN="CENTER"><B><FONT COLOR="#FFFFFF" SIZE="2" FACE="Arial,Helvetica,Univers,Zurich BT">Quantity On Hand Search Results</FONT></B>
		</td>
	</tr>
	</table>    	      
<c:choose>
<c:when test="${empty qohInfo}">
 
	    <div align="left" style="color:#336699;"><b>No records Found.<br><br></b></div>
</c:when>
<c:otherwise>
	<table width="602" height="92">
	     <tr>    
	          <th ALIGN=CENTER BGCOLOR="#336699" width="110" >
<B>
	                 <FONT COLOR="#FFFFFF" SIZE="-1" FACE="Arial,Helvetica,Univers,Zurich BT">Item Number</FONT>
</B>
	          </th>
	          <th ALIGN=CENTER BGCOLOR="#336699" width="115">
<B>
	                 <FONT COLOR="#FFFFFF" SIZE="-1" FACE="Arial,Helvetica,Univers,Zurich BT">Vendor Id </FONT>
</B>
	          </th>
	          <th ALIGN=CENTER BGCOLOR="#336699" width="120">
<B>
	                 <FONT COLOR="#FFFFFF" SIZE="-1" FACE="Arial,Helvetica,Univers,Zurich BT"> Inventory Date</FONT>
</B>
	          </th>
	          <th ALIGN=CENTER BGCOLOR="#336699" width="130" >
<B>
	                 <FONT COLOR="#FFFFFF" SIZE="-1" FACE="Arial,Helvetica,Univers,Zurich BT">Update Date Time </FONT>
</B>
	          </th>
	          <th ALIGN=CENTER BGCOLOR="#336699" width="100" >
<B>
	                 <FONT COLOR="#FFFFFF" SIZE="-1" FACE="Arial,Helvetica,Univers,Zurich BT">Quantity</FONT>
</B>
	          </th>
	     </tr> 
	     <c:forEach var="qohInfo" items="${qohInfo}" varStatus="loop">
    <tr BGCOLOR="#99CCFF">
      <TD align="center"><c:out value="${qohInfo.itemNumber}"/></TD>
      <TD align="center"><c:out value="${qohInfo.vendorId}"/></TD>
      <TD align="center"><c:out value="${qohInfo.inventoryDate}"/></TD>
      <TD align="center"><c:out value="${qohInfo.updateDateTime}"/></TD>
      <TD align="center"><c:out value="${qohInfo.quantity}"/></TD>
    </TR>
  </c:forEach>
  </table>
  </c:otherwise>
  </c:choose>

Open in new window

Micheal_MaleAsked:
Who is Participating?
 
mrcoffee365Connect With a Mentor Commented:
I think you didn't get any responses because the question was too vague.  It would help if you had tried to create a page with the query and the results on the same page, then asked about the errors you got.

For the basic question, you can use plain JSP code to control the display of your page.  For the initial display, when there are no results, you can wrap the results display with something like:
<%
  String submit = request.getParameter("Submit");
%>
 ... your constant display code here ...
<%
  if( submit != null ) {
%>
 ... your results display here ...
<%
  }
%>
0
 
mrcoffee365Commented:
Odd grade on the question.

If you needed more help, you could have asked for it here.
0
All Courses

From novice to tech pro — start learning today.