ASP Source Code

ASP File: stack.asp

 
   ASP Script
   Comments

<html>

<head>
<title>Stack</title>
</head>

<body background="logo.gif" bgcolor="#FFFFFF">

<form name="stackmain" method="post" action="stack.asp">
  <b><p>Please select a Option</b> <br>
  <select name="optselect" size="2">
    <option value="0" selected>ejb </option>
    <option value="1">jco </option>
  </select> </p>
  <table border="0" cellPadding="0" cellSpacing="0" width="75%" bgcolor="#FFFFFF"
  bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
    <tr>
      <td align="right"><strong><big>StackSize:</big></strong></td>
      <td><input NAME="stackText" MAXLENGTH="20" style="HEIGHT: 22px; LEFT: 190px; WIDTH: 143px"
      size="25"></td>
    </tr>
    <tr>
      <td align="right"><strong><big>Push:</big></strong></td>
      <td><input NAME="pushText" MAXLENGTH="20" size="60"></td>
    </tr>
  </table>
  <p><input type="submit" name="result" value="Pop Result"> </p>
<%
dim accountmanager
dim account

dim stack
dim push
dim istrue

stack = 0
push = 0
istrue = true

stack = Request("stackText")
push  = Request("pushText")

if (stack = "") then
     istrue = false
end if 

if (push  = "") then
    istrue = false
end if

if istrue then 

set selectValue = Request.Form("optSelect")
SelectOpton(selectValue)
Function SelectOpton(value)
	if value = "0" then
	    Response.Write "<br>"
	    Response.Write "EJB example:"
		set accountmanager = server.createobject("ejb.oas:StackDemo/ServerStack")
		SelectOpton = "ejb"
	else
	   if value = "1" then
		set accountmanager = server.createobject("jco.oas:myStack/ServerStack")
		Response.Write "<br>"
	    Response.Write "JCO example:"
	   end if	
	end if
End Function

if accountmanager is nothing then 
else 
    accountmanager.setStackSize(stack)
	for i = 1 to stack
	    accountmanager.push(push)
	Next
	'Response.Write typename(accountmanager)
	Response.Write "<br>"
	for j=1 to stack
	    Response.Write "<font size="& j &">" 
  		account = accountmanager.pop()
  		response.write(account)
		Response.Write "</font>"
		Response.Write "<br>"
	Next
	Response.Write "<br>"
	'accountmanager.remove()
end if
end if
%>
</form>
</body>
</html>