Danh mục tài liệu

XML, XSLT, Java, and JSP: A Case Study in Developing a Web Application- P11

Số trang: 50      Loại file: pdf      Dung lượng: 167.56 KB      Lượt xem: 10      Lượt tải: 0    
Xem trước 5 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

XML, XSLT, Java, and JSP: A Case Study in Developing a Web Application- P11: Là một nhà phát triển Web, bạn biết những thách thức trong việc xây dựng các ứng dụng mạnh mẽ trên nhiều nền tảng. Tạo các ứng dụng di động trở nên thật sự có thể bằng cách sử dụng Java cho code và XML để tổ chức và quản lý dữ liệu. "XML, XSLT, Java, và JSP: Một trường hợp học" sẽ giúp bạn tối đa hóa khả năng của XML, XSLT, Java, và JSP trong các ứng dụng web của bạn....
Nội dung trích xuất từ tài liệu:
XML, XSLT, Java, and JSP: A Case Study in Developing a Web Application- P11482 Appendix C Source Code for bonForum Web Application C.15 Filename: ProjectsonForumsrc BonForumRobot.java /**/ import java.io.*; import java.net.*; import java.util.*; import java.applet.*; import java.awt.Font; import java.awt.Color; import java.awt.Graphics; import java.awt.Component; // temp /**/ /** BonForumRobot repeatedly invokes showDocument method of applet. * It can be used from a frame display to request a different frameset. * It can also be used to continually refresh one frame from another. * The applet parameters are: * target, document, increment, limit, message and refresh. * For further information visit the open source * BonForum Project on SourceForge * @author Westy Rockwell */ public class BonForumRobot extends Applet { URL codeBase = null; String document = “”; String target = “”; String messageLineOne = “”; String messageLineTwo = “”; String message = “”; boolean refresh = false; boolean continueRunning = true; int increment = 0; int limit = 0; int counter = 0; Font font = new Font(“TimesRoman”, Font.ITALIC,24); public void init() { System.out.println(“init()”); // get other plugin parameters target = getParameter(“target”, “_self”); document = getParameter(“document”, “”); increment = getParameter(“increment”, 20000); limit = getParameter(“limit”, 10000); message = getParameter(“message”, “BonForumRobot applet”); refresh = getParameter(“refresh”, false); // see these debugging messages on the Java Console codeBase = this.getCodeBase(); System.out.println(“documentBase:” + this.getDocumentBase().toString()); System.out.println(“codeBase:” + codeBase.toString()); C.15 Filename: ProjectsonForumsrcBonForumRobot.java 483 System.out.println(“refresh:” + this.refresh); System.out.println(“target:” + this.target); System.out.println(“document:” + this.document); System.out.println(“increment:” + this.increment); System.out.println(“limit:” + this.limit); System.out.println(“message:” + this.message); // forces application global error displays not to be in a frame: if(document.indexOf(“forum_error”) > -1) { if(!target.equals(“_top”)) { target = “_top”; System.out.println(“changed to forum_error target:” +this.target); } } } public void start() { // kick off thread to do the dirty work setBackground(Color.cyan); System.out.println(“start()”); if (refresh) { RefreshThread thread = newRefreshThread(Long.toString(System.currentTimeMillis()), codeBase); thread.start(); } } public void stopRunning() { stop(); } public void stop() { System.out.println(“stop()”); continueRunning = false; } public void paint(Graphics graphics) { graphics.setFont(font); graphics.setColor(Color.black); if(message.equalsIgnoreCase(“debug”)) { graphics.drawString(messageLineOne,10,20); graphics.drawString(messageLineTwo,10,40); graphics.drawString(target,10,60); graphics.drawString(document,10,80); graphics.drawString(new Boolean(refresh).toString(), 10, 100); graphics.drawString(Integer.toString(increment), 10, 120); graphics.drawString(Integer.toString(limit), 10, 140); } else { graphics.drawString(messageLineOne,10,20); graphics.drawString(messageLineTwo,10,40); }484 Appendix C Source Code for bonForum Web Application } private String getParameter(String name, String defaultValue){ String retval = getParameter(name); if (retval == null || retval.trim() == “”){ retval = defaultValue; } return retval; } ...