我正在处理银行申请。尽管我似乎无法弄清楚如何使显示方法打印到客户端而不是服务器日志,但我的大多数业务对象都能正常工作。对大多数人来说,这似乎很容易,但我还是有些困惑。
这是jsp:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import= "business.AccountList" %>
<%@page import= "business.Customer" %><!--Space between =" makes the String orange-->
<%@page import= "business.Account" %><!--Space between =" makes the String orange
or black.-->
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html lang="en-US">
<head>
<meta charset="UTF-8" />
<meta name="description" content="Display Accounts Page" />
<meta name="keywords" content="HTML, Java" />
<meta name="author" content="Robert McGuire " />
<!--<meta http-equiv="refresh" content="30" />-->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Display Accounts Page</title>
<!--<link rel="stylesheet" type="text/css" href="style_General.css" />-->
<!--[if lt IE 9]>
<script src="/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<%
Customer c1 = (Customer)session.getAttribute("c1");
out.println("Customer object from session:"+c1);
//Account a1 = (Account)session.getAttribute("a1");
//out.println("Account object from session:"+a1);
//c1.display();
//c1.list.arr[0].display();
int c =c1.list.count;
for(int i =0; i<c;i++){
c1.list.arr[i].display();
}
%>
<h1>Welcome <%=c1.getCustFirstName()%> <%=c1.getCustLastName()%> .</h1>
<p>Address : <%=c1.getAddress()%> </p>
<p>Email : <%=c1.getEmail()%> </p>
<h2>Your Account details are listed here.</h2>
<!--Form Section.-->
<div>
<!-- <form action="http://localhost:8080/WebApplication12/AccountLookupServlet" method="post">
<pre>
Account No: <input type="text" name="accountNumber" placeholder="Account ##"><br>
Customer ID:<input type="text" name="custId" placeholder="Customer ID"/><br>
Type: <input type="text" name="type" placeholder="Account Type"/><br/>
Balance: <input type="text" name="balance" placeholder="Balance"/>
<br/>
<input type="submit" value="Retrieve" /><input type="reset" value="Clear" />
</pre>
</form>-->
</div>
<!--putting the acct info back into the page not into the textboxes. -->
<div>
<table>
<thead>Account Information</thead>
<hr/>
<br/>
<tr>Account Number:<%= c1.list.arr[c]%></tr><br/>
<tr> _________Display___________</tr><br/>
<tr> Customer Id:<%c1.getCustId(); %></tr><br/>
<%-- <tr> Account Type:<%c1.getAccounts() %> --%>
<!-- Info: Account Type: Checking -->
<!-- Info: Account Balance: 1000.0 -->
</table>
</div>
<%
//Putting the objects back into the session .
session = request.getSession();
//session.setAttribute("a1", a1);
session.setAttribute("c1", c1);
%>
<hr />
<!--Footer section with all the navigation links.-->
<footer>
<a href="index.jsp" style="text-decoration: none">Homepage</a>
<a href="login.jsp" style="text-decoration: none">Login Page</a>
</footer>
</body>
</html>
控制台显示有效...我只是想不通如何将数据从Account对象获取到jsp。
香港专业教育学院试图添加JspWriter作为由display()接受的参数。我无处可去 我一直在阅读有关此JspWriter的文章,但不了解如何正确使用它。我要做的就是访问:
public void display() {
System.out.println("_________Display___________");
System.out.println(" ");
System.out.println("Account Number: " + getAccountNo());
System.out.println("Customer Id:" + getCustomerID());
System.out.println("Account Type: " + getAccountType());
System.out.println("Account Balance: " + getBalance());
这从提供的jsp页面开始。我不知道如何使用JspWriter来完成此任务。
真诚的感谢。
ps。在不了解其他技术之前,我将使用scriptlet标签。我从未得知使用scriptlet标签是不好的做法。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。