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

XML, XSLT, Java, and JSP: A Case Study in Developing a Web Application- P7: 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 | 282 Chapter 8 Java Servlet and Java Bean BonForumEngine and BonForumStore method as returns actorKeys which is an array list of nodeKeys either for all host nodes or for all guest nodes in bonForumXML. The chatGuest and chatHost session attribute values chatActor strings have the following format which depends upon the XSL document used in the XSLT process that displays the lists of hosts and guests actorNickname age actorAge rating actorRating Here is an example John Doe age 47 rating 11 The actorNicknarne is recovered from that string and is used as follows NodeKey actorNodeKey getActorByNickname actorKeys actorNicknarne The getActorByNickname method selects the correct actor nodeKey from the list for the correct one. It is then used as follows NodeKey actorRatingNodeKey getActorRatingForActor actorNodeKey The getActorRatingForActor method gets the nodeKey of the actorRating node. That node is a child of the actor node for the actorNodeKey. The content of the actorRating node is the current rating for the actor being rated. The final statement in the changeChatActorRating method is the following return changeActorRating actorRatingNodeKey amount The changeActorRating method gets the actorRating node from its key the first argument. It then parses the actorRating node content and the amount argument as integer values. The rating value is offset by the amount value 1 or -1 in our case to get a new rating which is converted to a string. Finally the actorRatingNodeKey and the new rating value for the actorRating node content are both passed to the editBonNode method of the database method takes care of updating the actor rating in the XML data we will spare you the details . Accessing Bean Properties and Methods from JSP You just saw a bean method changeChatActorRating being called from a JSP. We will now show several ways to access bean properties and to call bean methods from JSP. The property examples will use two BonForumStore .