JSP10employeeRepeatResults.jsp example

See the Code example disclaimer for legal information about this code examples.

<!-- JSP10employeeRepeatResults.jsp -->

<HTML>
<HEAD>
<TITLE>JSP 1.0 Employee Results</TITLE>
</HEAD>
<H1><CENTER>EMPLOYEE RESULTS</CENTER></H1>
<BODY>

<% String   userID = request.getParameter("USERID"); %>
<% String   passWord = request.getParameter("PASSWD"); %>

<% String   empno    = request.getParameter("EMPNO"); %>
<% String   firstnme = request.getParameter("FIRSTNME"); %>
<% String   midinit  = request.getParameter("MIDINIT"); %>
<% String   lastname = request.getParameter("LASTNAME"); %>
<% String   workdept = request.getParameter("WORKDEPT"); %>
<% String   edlevel  = request.getParameter("EDLEVEL"); %>

<!-- Get a connection to the local DB2 database using parameters from Login.jsp -->
<tsx:dbconnect id="conn" url="jdbc:db2:*local" driver="com.ibm.db2.jdbc.app.DB2Driver">
<tsx:userid><%=userID%></tsx:userid>
<tsx:passwd><%=passWord%></tsx:passwd>
</tsx:dbconnect>

<% if  ( ( request.getParameter("Submit")).equals("Update") ) { %>
<tsx:dbmodify connection="conn" >
   INSERT INTO  WSDEMO.EMPLOYEE 
   (EMPNO,FIRSTNME,MIDINIT,LASTNAME,WORKDEPT,EDLEVEL)
   VALUES
    ( '<%=empno%>',
    '<%=firstnme%>',
     '<%=midinit%>',
     '<%=lastname%>',
    '<%=workdept%>',
    <%=edlevel%>)
    </tsx:dbmodify>
 <B><UL>UPDATE SUCCESSFUL</UL></B>
 <BR><BR>
<tsx:dbquery id="qs" connection="conn" >
   select * from WSDEMO.EMPLOYEE  where  WORKDEPT= '<%=workdept%>'
</tsx:dbquery>


<B><CENTER><U>EMPLOYEE LIST</U></CENTER></B><BR><BR>
<HR>
<TABLE>
<TR VALIGN=BOTTOM>
<TD><B>EMPLOYEE
<BR>
<U>NUMBER</U></B></TD>
<TD><B><U>NAME</U></B></TD>
<TD><B><U>DEPARTMENT</U></B></TD> 
<TD><B><U>EDUCATION</U></B></TD>
</TR>

<tsx:repeat>
<TR>
<TD><B><I><tsx:getProperty name="qs" property="EMPNO" /></I></B></TD>
<TD><B><I><tsx:getProperty name="qs" property="FIRSTNME" /></I></B></TD>
<TD><B><I><tsx:getProperty name="qs" property="WORKDEPT" /></I></B></TD>
<TD><B><I><tsx:getProperty name="qs" property="EDLEVEL" /></I></B></TD>
</TR>
</tsx:repeat> 

</TABLE>


<HR>
<BR>
<% } %>

<% if  ( ( request.getParameter("Submit")).equals("Query") ) { %>

<tsx:dbquery id="qs2" connection="conn" >
   select * from WSDEMO.EMPLOYEE  where  WORKDEPT= '<%=workdept%>'
</tsx:dbquery>


<B><CENTER><U>EMPLOYEE LIST</U></CENTER></B><BR><BR>
<HR>
<TABLE>
<TR>
<TR VALIGN=BOTTOM>
<TD><B>EMPLOYEE
<BR>
<U>NUMBER</U></B></TD>
<TD><B><U>NAME</U></B></TD>
<TD><B><U>DEPARTMENT</U></B></TD>
<TD><B><U>EDUCATION</U></B></TD>
</TR>

<tsx:repeat>
<TR>
<TD><B><I><tsx:getProperty name="qs2" property="EMPNO" /></I></B></TD>
<TD><B><I><tsx:getProperty name="qs2" property="FIRSTNME" /></I></B></TD>
<TD><B><I><tsx:getProperty name="qs2" property="WORKDEPT" /></I></B></TD>
<TD><B><I><tsx:getProperty name="qs2" property="EDLEVEL" /></I></B></TD>
</TR>
</tsx:repeat> 
</TABLE>
<HR>
<BR>
<% } %>

</BODY>
</HTML>