Place holder for the generated UI. This may be any html element.

In this case the genenerated form will be placed within a div with the id #VISUALIZER_CONTENT.

Note:
Be sure you add the JAXFront css class marker named JAX-MARKER for this target div.
  • Add the file jaxfront-ajax.js (found in jaxfront-demo.war) into your html head section
    <script language="JavaScript" src="js/jaxfront-ajax.js" type="text/javascript"></script>
  • Call the javascript function 'createHTML' to render a JAXFront HTML form
    createHTML(elementRef, 'serverAddress', 'servletName', 'htmlTargetID', 'optinalURLParams', 'language');
    We used this params in this example:
    createHTML(this, null, 'APIDemoServlet', 'VISUALIZER_CONTENT', '&action=api-go', 'de');
    
  • Copy the following content (found in jaxfront-demo.war) to your web project root directory:
    js
    lic
    style
    templates
    WEB-INF/jaxfront.xml
    WEB-INF/lib/*.jar
    WEB-INF/lib/jaxfront.tld (for JSP usage only)
    
  • Add the JAXFrontRequestFilter in your web.xml
    <filter>
      <filter-name>JAXFrontRequestFilter</filter-name>
      <filter-class>com.jaxfront.html.servlet.JAXFrontRequestFilter</filter-class>
    </filter>
    <filter-mapping>
      <filter-name>JAXFrontRequestFilter</filter-name>
      <url-pattern>/*</url-pattern>
    </filter-mapping>
    
  • Implement your own java servlet (see APIDemoServlet.java)
    public class APIDemoServlet extends HttpServlet {
    	public void service(HttpServletRequest request, HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException {
    		String action = request.getParameter("action");
    		if (action != null && action.equals("api-go")) {
    			apigo(request, response);
    		} else {
    			super.doPost(request, response);
    		}
    	}
    
    	private void apigo(HttpServletRequest request, HttpServletResponse response) {
    		response.setContentType("text/html; charset=UTF-8");
    		StringBuffer formContentXHML = new StringBuffer();
    		String language = request.getParameter("language");
    		String xsdURL = JAXFrontServletAdapter.getRealPath("examples/purchaseOrder/po.xsd");
    		String xml = null;
    		String xuiURL = JAXFrontServletAdapter.getRealPath("examples/purchaseOrder/po.xui");
    		DOMActionController actionController = new MyOwnDOMActionController();
    		String id = API.buildForm(formContentXHML, request, URLHelper.getUserURL(xsdURL), URLHelper.getUserURL(xml), URLHelper.getUserURL(xuiURL), actionController, language);
    		// keep this id to get the JAXFront Document later on to serialize XML > dom.serialize();
    		DOMHandler domHandler = API.getFormDOM(request, id);
    		if (domHandler != null) {
    			Document jaxfrontDOM = domHandler.getDOM();
    		}
    		try {
    			response.getWriter().write(formContentXHML.toString());
    		} catch (IOException e) {}
    	}
    }
    
This demo servlet will generate an interactive XHML form based on the following resources: