\\
The DOMActionController (i.e. MyOwnDOMActionController class) let you interact with the generated web form. You may even define your own web form buttons to interacte with the form (save, validate, print, ...).
!worddave6290d961dc319b85aba0adbde617440.png|height=31,width=29!
To handle a save request on your own, just overwrite the method saveDOM().
\\
<span style="color: #7f0055"><strong>public</strong></span> ResultObject saveDOM() \{
ResultObject result = <span style="color: #7f0055"><strong>new</strong></span> ResultObject();
String category = ResultObject.<span style="color: #0000c0"><em>OK</em></span>;
String statusMessage = <span style="color: #7f0055"><strong>null</strong></span>;
String xmlIdentifier = <span style="color: #7f0055"><strong>null</strong></span>;
<span style="color: #7f0055"><strong>if</strong></span> Wiki-Markup
To handle a save request on your own, just overwrite the method saveDOM().
public ResultObject saveDOM() {
ResultObject result = new ResultObject();
String category = ResultObject.OK;
String statusMessage = null;
String xmlIdentifier = null;
if (getDOMHandler().getXMLIdentification().<span style="color: #0000c0">length</span> > length > 0) \{
xmlIdentifier = {
xmlIdentifier = getDOMHandler().getXMLIdentification()\[0\];
\}
\\
<span style="color: #7f0055"><strong>try</strong></span> \{
String xml =
}
try {
String xml = getDOM().serialize().toString(); <span style="color: #3f7f5f">//store this xml to your DB as an example</span>
statusMessage = <span style="color: #2a00ff">"Document has been stored successfully"</span>;
\} <span style="color: #7f0055"><strong>catch</strong></span> (ValidationException e) \{
category = ResultObject.<span style="color: #0000c0"><em>ERROR</em></span>;
statusMessage = <span style="color: #2a00ff">"Failed to save. Reason: "</span> + an example
statusMessage = "Document has been stored successfully";
} catch (ValidationException e) {
category = ResultObject.ERROR;
statusMessage = "Failed to save. Reason: " + e.getLocalizedMessage();
\}
_setClientStatusBarMessage{_}
}
setClientStatusBarMessage((HttpServletRequest)getDOM().getClientProperty(<span style="color: #2a00ff">"http-request"</span>), getDOM(),result, category, statusMessage, <span style="color: #7f0055"><strong>null</strong></span>);
<span style="color: #7f0055"><strong>return</strong></span> result;
\}
\\
\\
!worddave6290d961dc319b85aba0adbde617440.png|height=31,width=29! If you want to have your own buttons on top of your form, just overwrite the method getHTMLButtonControls(). If you do not overwrite, the button defined in the template null);
return result;
}
If you want to have your own buttons on top of your form, just overwrite the method getHTMLButtonControls(). If you do not overwrite, the button defined in the template "ControlFrame.html" will be taken.
\\
<span style="color: #7f0055"><strong>public</strong></span> String
public String getHTMLButtonControls(HttpServletRequest request) \ {
//return an xhtml string defining your form buttons
\}
\\
To call a specific user action in your own ActionController, an action can be called wherever in your HTML web frontend by calling one of the following javascripts:
\\
a) without any return value (return null),
}
To call a specific user action in your own ActionController, an action can be called wherever in your HTML web frontend by calling one of the following javascripts:
a) without any return value (return null), performUserAction('actionName')
b) with a return value (return anObject), performUserActionWithPopUp('actionName')
\\
Option b) will open a dialog window with the content of the passed Object.
\\
The following html snippets shows how to call an own action.
\\
<button id= "button_ownAction1" name="test" type="button" onclick="performUserActionWithResponseDIV(this,'ownAction1', null, 'DIV_CUSTOM_AREA',null);">
<p><img src="$\{IMAGE_BASE\}hint_16x16.gif"/> <b>own action 1</b> </p>
</button>
\\
\\
\\
!worddave6290d961dc319b85aba0adbde617440.png|height=31,width=29! To interact with the button clicked on your web form, just implement the method performUserAction().
\\
<span style="color: #7f0055"><strong>public</strong></span> ResultObject performUserAction(HttpServletRequest request, HttpServletResponse response, String actionName) \{
ResultObject result = <span style="color: #7f0055"><strong>new</strong></span> ResultObject();
<span style="color: #7f0055"><strong>if</strong></span> (<span style="color: #2a00ff">"ownAction1"</span>
To interact with the button clicked on your web form, just implement the method performUserAction().
public ResultObject performUserAction(HttpServletRequest request, HttpServletResponse response, String actionName) {
ResultObject result = new ResultObject();
if ("ownAction1".equals(actionName)) \{
StringBuffer htmlResponse = <span style="color: #7f0055"><strong>new</strong></span> {
StringBuffer htmlResponse = new StringBuffer();
htmlResponse.append(<span style="color: #2a00ff">"<br/>"</span>);
"<br/>");
htmlResponse.append(<span style="color: #2a00ff">"<b>Hello"<b>Hello...</span>
result.setObject(htmlResponse);
\} <span style="color: #7f0055"><strong>else</strong></span> <span style="color: #7f0055"><strong>if</strong></span> (<span style="color: #2a00ff">"ownAction2"</span>
} else if ("ownAction2".equals(actionName)) \{
StringBuffer htmlResponse = <span style="color: #7f0055"><strong>new</strong></span> {
StringBuffer htmlResponse = new StringBuffer();
htmlResponse.append(<span style="color: #2a00ff">"<br/><br/><br/>"</span>);
"<br/><br/><br/>");
htmlResponse.append(<span style="color: #2a00ff">"<b>Hello JAXFront "<b>Hello JAXFront user...</span>
result.setObject(htmlResponse);
\} <span style="color: #7f0055"><strong>else</strong></span> <span style="color: #7f0055"><strong>if</strong></span> (<span style="color: #2a00ff">"forwardToJSPAction"</span>
} else if ("forwardToJSPAction".equals(actionName)) \{
RequestDispatcher dispatcher = {
RequestDispatcher dispatcher = request.getRequestDispatcher(<span style="color: #2a00ff">"/examples/purchaseOrder/hello.jsp"</span>);
<span style="color: #7f0055"><strong>try</strong></span> \{
);
try {
dispatcher.forward(request, response);
\} <span style="color: #7f0055"><strong>catch</strong></span> (Exception e) \{\}
} catch (Exception e) {}
result.setDispatched();
\} <span style="color: #7f0055"><strong>else</strong></span> \{
result = <span style="color: #7f0055"><strong>super</strong></span>
} else {
result = super.performUserAction(request, response, actionName);
\}
<span style="color: #7f0055"><strong>return</strong></span> result;
\}
\\
\\
The action name
}
return result;
}
The action name (i.e. "ownAction1") gets passed to the current DOM action controller. The action controller can implement the action. Each action is identified by a unique action name.
\\
Be sure that the correct mime type for the returned object has been registered before. To register a mime type for an own user action, call the following method on class "JAXFrontServlet":
\\
JAXFrontServlet.registerMimeTypeMapping("actionName", "mimeType");
\\
\\
\\
\\
\\
\\
\\
\\