,ch14.9433  Page 481  Monday, February 14, 2005  12:55 PM
In a STXX application, your action form holds XML data. STXX provides two spe 
cialized classes that wrap XML data in an
ActionForm
. The contained XML can be
represented as a traditional DOM object using the
DOMForm
or as a JDOM object
using
JDOMForm
. JDOM provides a more natural API than DOM, so the
JDOMForm
was
used in this recipe.
This
form bean
element references an XML model that describes the XML structure
of the form data. The XML models for your application are defined in the WEB INF/
xmlform models.xml file. Example 14 32 shows the model, representing user infor 
mation, used in this recipe.
Example 14 32. XML models used by STXX
  
    
      
          
          
      
      
    
  
A custom action in STXX performs the same functions as in a conventional Struts
application: you retrieve data from the form, access the model, and forward to a des 
tination. For STXX, the pattern can be specifically laid out as follows:
1. Retrieve the
ActionForm
 and extract the form data as a DOM or JDOM object.
2. Access the business model to retrieve data.
3. Format the data into an XML in memory representation.
4. Forward the request to a STXX transformation pipeline.
The actions defined in Example 14 31 represent a typical flow common to most web
applications. The first action, /viewUserList, displays data on a page. The second
action, /addUser, presents a form where a user can input data. The third action,
/saveUser, saves the data in the model and forwards back to the first action.
Here's the first action mapping:
           type="com.oreilly.strutsckbk.ch14.UserListAction">
    
The
UserListAction
, shown in Example 14 33, retrieves data stored in application 
scope and builds a JDOM document from it. The action saves the document in the
request and forwards to  success. 
Integrating Struts and XSLT | 481
This is the Title of the Book, eMatter Edition
Copyright   2005 O'Reilly & Associates, Inc. All rights reserved.






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

strutsweb hosting

 

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved