<jsp:useBean id="bankbean" scope="session" class="bank.Bankbean01" /> <jsp:setProperty name="bankbean" property="*"/> <%! double balance; double amount; %> <html> <head> <title> Hometown Bank </title> </head> <body > <H1 align=center> Hometown Bank </H1> <% balance=bankbean.getBalance(); if (balance<0.0) { out.print("<p><b> Sorry, invalid username or password </b>"); %> <form method=post action=JSPbank.htm> <input type=submit value="try again!"> </form> </body> </html> <% } else { String amountstring=request.getParameter("amount"); if ( amountstring !=null){ if (amountstring.trim().length()==0){ amount=0; } else { amount = Double.valueOf(amountstring.trim()).doubleValue(); } } else { amount=0; } if(amount>0) { if (request.getParameter("Deposit") != null) { balance=balance+amount; bankbean.setBalance(balance); out.print("<p> $" + amount + " deposited"); } if (request.getParameter("Withdraw") != null) { balance=balance-amount; bankbean.setBalance(balance); out.print("<p> $" + amount + " withdrawn"); } } out.print("<p> Balance: $" + balance); %> <FORM method=post action=Bank01.jsp> <INPUT TYPE=hidden NAME=username VALUE= <%= bankbean.getUsername() %> > <INPUT TYPE=hidden NAME=password VALUE= <%= bankbean.getPassword() %> > Enter Amount: <INPUT name=amount> <P> <INPUT name=Deposit type=submit value=Deposit> <INPUT name=Withdraw type=submit value=Withdraw> <INPUT name=".defaults" onclick="javascript:location='JSPbank.htm'" type="button" value="Cancel"> </P> </FORM> </BODY> </HTML> <% } %>