Example of xwork dtd<!-- XWork configuration DTD. Use the following DOCTYPE <!DOCTYPE xwork PUBLIC "-//OpenSymphony Group//XWork 1.1.1//EN" "http://www.opensymphony.com/xwork/xwork-1.1.1.dtd"> --> <!ELEMENT xwork (package|include)*> <!ELEMENT package (result-types?, interceptors?, default-interceptor-ref?, default-action-ref?, global-results?, global-exception-mappings?, action*)> <!ATTLIST package name CDATA #REQUIRED extends CDATA #IMPLIED namespace CDATA #IMPLIED abstract CDATA #IMPLIED externalReferenceResolver NMTOKEN #IMPLIED > <!ELEMENT result-types (result-type+)> <!ELEMENT result-type (param*)> <!ATTLIST result-type name CDATA #REQUIRED class CDATA #REQUIRED default (true|false) "false" > <!ELEMENT interceptors (interceptor|interceptor-stack)+> <!ELEMENT interceptor (param*)> <!ATTLIST interceptor name CDATA #REQUIRED class CDATA #REQUIRED > <!ELEMENT interceptor-stack (interceptor-ref+)> <!ATTLIST interceptor-stack name CDATA #REQUIRED > <!ELEMENT interceptor-ref (param*)> <!ATTLIST interceptor-ref name CDATA #REQUIRED > <!ELEMENT default-interceptor-ref (param*)> <!ATTLIST default-interceptor-ref name CDATA #REQUIRED > <!ELEMENT default-action-ref (param*)> <!ATTLIST default-action-ref name CDATA #REQUIRED > <!ELEMENT external-ref (#PCDATA)> <!ATTLIST external-ref name NMTOKEN #REQUIRED required (true|false) "true" > <!ELEMENT global-results (result+)> <!ELEMENT global-exception-mappings (exception-mapping+)> <!ELEMENT action (param|result|interceptor-ref|exception-mapping|external-ref)*> <!ATTLIST action name CDATA #REQUIRED class CDATA #IMPLIED method CDATA #IMPLIED converter CDATA #IMPLIED > <!ELEMENT param (#PCDATA)> <!ATTLIST param name CDATA #REQUIRED > <!ELEMENT result (#PCDATA|param)*> <!ATTLIST result name CDATA #IMPLIED type CDATA #IMPLIED > <!ELEMENT exception-mapping (#PCDATA|param)*> <!ATTLIST exception-mapping name CDATA #IMPLIED exception CDATA #REQUIRED result CDATA #REQUIRED > <!ELEMENT include (#PCDATA)> <!ATTLIST include file CDATA #REQUIRED > Example of xwork.xml<xwork> <package name="person" extends="webwork-default" namespace="/person"> <action name="listPeople" class="com.opensymphony.webwork.showcase.person.ListPeople"> <interceptor-ref name="validationWorkflowStack"/> <result type="freemarker">listPeople.ftl</result> </action> <!-- our JasperReports example --> <action name="jasperList" class="com.opensymphony.webwork.showcase.jasper.JasperAction"> <result name="success" type="jasper"> <param name="location">/jasper/sample_report.jasper</param> <param name="dataSource">people</param> <param name="documentName">peoplereport</param> </result> </action> <action name="newPerson" class="com.opensymphony.webwork.showcase.person.CreatePerson"> <result type="redirect">listPeople.action</result> <result name="input" type="freemarker">newPerson.ftl</result> </action> <action name="editPerson" class="com.opensymphony.webwork.showcase.person.EditPerson"> <result>editPeople.jsp</result> </action> <action name="doEditPerson" class="com.opensymphony.webwork.showcase.person.EditPerson" method="save"> <result name="error">editPeople.jsp</result> <result type="redirect">listPeople.action</result> </action> </package> </xwork> Do not forget to include the webwork-default configuration files; they contain pre-made stacks, the result types, validators and more. To include them, add the following line after your xwork root element: <xwork> <include file="webwork-default.xml"/> .. For more information about the configuration details see XWork Configuration |