::::::::::::::::::::::::::
Home
Home Page
Method of generation of a code
Displays
Result of binding of the data
Systems of patterns of pages
Data acquisition without use XML
Data acquisition without use XML
Use JSON on the party of the client
Improved online shop
Review Ajax
Departure XMLHttpRequest
Processing of search servleta
 The search processing with help JavaScript
Problems of use Ajax
As it was more than once spoken, organization W3C is engaged mainly in development and creation of b
OASIS
Hands off PHP!
Automatic redirect (Auto Redirect) on PHP
Breaking of passwords becomes more accessible
Web2.0 Layout
Links
:::::::::::::::::::::::::

 

Systems of patterns of pages


Any technology of a pattern of widely used pages can be used for generation XML, allowing Ajax-applications to create the any XML-document of search from his{its} model of the data. Plus still that samples can be written, with use of simple and expressive language, as against lines of a code, napisannnogo in language Java. Listing 4 - page JSP which declares Customer bean and returns the usual performance XML suitable to a code of the client to create components of history Order.


Listing 4. Page JSP which makes a component of a history order



<? xml version = " 1.0"?>

<% page contentType = "application/xml" %>

<% taglib uri = " http: // java.sun.com/jsp/jstl/core " prefix = "c" %>

<c:set var = "cust" value = " $ {requestScope.customer} "/>


<orderhistory username = " $ {cust.username} ">

<c:forEach var = "order" items = " $ {cust.orders} ">

<order id = " $ {order.id} " cost = " $ {order.formattedCost} ">

<date> $ {order.date} </date>

<items>

<c:forEach var = "item" items = " $ {order.items} ">

<item id = " $ {item.id} ">

<name> <c:out value = " $ {item.name} " escapeXml = "true"/> </name>

<price> $ {item.formattedPrice} </price>

</item>

</c:forEach>

</items>

</order>

</c:forEach>

</orderhistory>


This rather brief pattern deduces only the data necessary for a kind of history Order, and has no such data, as the description of each product. And in fact it can be made also simply, as well as to create usual XML for performance of search of a product which includes the full description and a level of a drain for each thing.


The problems arising at use of patterns


The return party{side} of a medal is necessity to create new JSP for each differing kind which is required to us, as against configuration of required circuits of objects and serialization of them. From the point of view of development many could argue, what is it will be in any case an output{exit} as it means formal processing types of the document which will be made with the server. Also as we now work, basically, with Wednesday of a pattern and not in specific interfaces (XML API), my duty will be convinced, that links are determined, elements and the order of attributes korrekteny, and any mistakes (for example, <or ?) are corrected. The basic JSP teg out easily carries out last task, but not all technologies of patterns cope with it. At last, there is no easy way validirovanija the generated XML-document according to the circuit of the server, and it in any case not what you expected from Wednesday, but you can easily work with them within the framework of development.