JSP操作技巧(11)
4714 点击·0 回帖
![]() | ![]() | |
![]() | JSP文件本身是简单的。它从application获取留言本并在表中显示内容。通常, application对象需要同步,因为一些客户端可能同时浏同一页面。 GuestJsp在jsp文件被调用之前小心处理了同步情况。 login.jsp: Display Guest Book <%@ page language=javascript %> <head> <title>Hogwarts Guest Book</title> </head> <body bgcolor='white'> <h1>Hogwarts Guest Book</h1> <table> <tr><td width='25%'><em>Name</em><td><em>Comment</em> <% var guestBook = application.attribute.guest_book for (var guest in guestBook) { out.writeln("<tr><td>" + guest.name + "<td>" + guest.comment); } %> </table> </body> Hogwarts Guest Book Name Comment Harry Potter Griffindor Rules Draco Malfoy Slytherin Rules | |
![]() | ![]() |