NO. Dependencies page shows the dependency to servlet-api but please take notice of "optional" flag. You need servlet-api if you use Mixer2XhtmlView class with SpringMVC framework.
xhtml1.0-transitional, xhtml1.0-strict, html5 with xml syntax. The spec of html5 is May 2011 version.
Mixer2 is also compatible for data-*, aria-* properties of html5. Mixer2 can't understand orignal tag like <foo>bar</foo> . If you use original tag on template, mixer2 will delete it.
Mixer2 does NOT validate html when load(unmarshal) template html and save(marshal) to html.
For example, case like below.
template:
<b> aaa <div>bbb</div> ccc </b>
load by mixer2, do nothing, and saveToString():
<b>aaa ccc</b>
b tag cannot include div tag because b tag is inline element but div tag is block element. This is NG on xhtml specification.
Mixer2 ignore these invalid tags and no warning.
The other case nelow.
template.
<div id="a">xxx</div> <div id="a">yyy</div>
This template is NG because one web page can not have tags that has same id property. But mixer2 ignore this.
load by mixer2, do nothing, and saveToString():
<div id="a">xxx</div> <div id="a">yyy</div>
You should use syntax check function of web authoring tool (ex. Dreamweaver) or htmllint when you write html template.
Mixer2 forget any DOCTYPE declareation at the front of template. If JAXB-API detect DOCTYPE declaration on the way of analyzing template, JAXB-API access the URI and it leads heavy overhead.
If the output of your application needs DOCTYPE declaration, you should add it manually on your code.
<!-- comment... -->
<!--[if IE]> <link rel="stylesheet" href="layout_ie.css" type="text/css" /> <![endif]-->
All the html comment on template will be deleted. This is a feature of Unmarshaller class of Java6 JAXB-API. By reason of this, The conditional comment - http://msdn.microsoft.com/en-us/library/ms537512 - will be deleted also.
JavaScript shuold be external file.
template:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
output of mixer2:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"> </script>
The one white space in script tag is expected behavior. Transofrmer class rewrite the tag that has only property but no content to like this <script type="text/javascript" src="foo.js" /> . For example Firefox can't run script tag like this.
If you feel a strong need to write inline javascript on xhtml, use CDATA and // (comment out) on template.
template:
<script type="text/javascript"> //<![CDATA[ var foo = 1; var bar = 2; if (foo > bar || foo < bar) { var bar = 3; } //]]></script>
output by mixer2:
<script type="text/javascript"> //<![CDATA[ var foo = 1; var bar = 2; if (foo > bar || foo < bar) { var bar = 3; } //]]> </script>
You should handle "IDREF(S)" property with care. Typical case is label tag like <label for="foo"> .
For example, loading template like below.
<label id="barInputLabel" for="barInput">input bar:</label> <input id="barInput" type="text" name="barInput" />
Object obj = html.getById("barInputLabel", Label.class).getFor()
"obj" is not "barInput" String. It is instance of Input class having id="barInput" .
If you set "for" property to label tag object with the code like label.setFor("barInput") , you get exception.
Input barInput = html.getById("barInput", Input.class); html.getById("barInputLabel", Label.class).setFor(barInput);
So, you need to pass the object having the id property to the setFor() method.
Most class of mixer2 is thread save. If the class is not thread safe, the javadoc is written like this "this class is not thread safe".
To instantiate Mixer2Engine is high cost. You shuold instantiate mixer2engine as singleton and inject it to DI container.
Mixer2 has an advantage for security. For example, to make <script> tag, It must be exists on template or you must write code "Script script = new Script();" explicitly.
All the tag class of mixer2 implements java.io.Seralizable and have copy() method. You can implements original caching function by combination of general caching framework.
See also Mixer2-Cacheable project.
Sample application or maven archetype of mixer2 uses maven. Maven will download java libraries with http(s) from central repository on internet automatically.
In some cases, you need web proxy authentication to internet access. Here is document of it on maven official site.
See team page or mailing list page