Link to home
Start Free TrialLog in
Avatar of Micheal_Male
Micheal_MaleFlag for Afghanistan

asked on

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

ASKER CERTIFIED SOLUTION
Avatar of mrcoffee365
mrcoffee365
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Odd grade on the question.

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