Frequently Asked Questions
- Where can I find documentation or HowTos for using Tobago?
- Where can I find a "Hello World" example and a list of required jars?
- Does Tobago run with the Sun reference implementation (RI)?
- Does Tobago supports Facelets?
- Can I mix Tobago and MyFaces extensions in the same web application?
- How do I use GridLayout in Tobago?
- How do I configure file upload in Tobago?
- Do I need a form tag in a normal Tobago page?
- Which web browsers are currently supported by Tobago?
- How do I create my own theme?
- How do I use and extend the markup attribute?
- In which containers was Tobago tested?
- Can Tobago replace Tiles? Can I ignore Tiles and Sitemesh in favor of Tobago?
- How to configure a maven mirror?
- How do I configure an offline build?
- How do I perform a local checkstyle check?
- Why my Subversion checkout fails on Windows?
- How can I run the Selenium tests?
- How can I run the Tobago demo with WebSphere Liberty Profile (WLP) from Maven?
- Where can I find documentation or HowTos for using Tobago?
-
Please, see
and especially the section for best practices:
- Where can I find a "Hello World" example and a list of required jars?
-
Please look at tobago-example-blank or download the myfaces-tobago-example from the nightly builds directory.
- Does Tobago run with the Sun reference implementation (RI)?
-
Tobago runs with Sun RI and with MyFaces. Please take a look at the Compatibility List.
- Does Tobago supports Facelets?
-
Tobago supports Facelets with the tobago-facelets.jar. Note: Please add following context param in your web.xml
<context-param> <param-name>facelets.SKIP_COMMENTS</param-name> <param-value>true</param-value> </context-param>
- Can I mix Tobago and MyFaces extensions in the same web application?
-
JSF only supports one renderkit (renderkitId) per page (f:view). Because Tobago has it's own renderkitId you cannot use any non-Tobago components that need a renderer.
- How do I use GridLayout in Tobago?
-
<tc:gridLayout rows="fixed;100px;1*;2*" />
The attribute 'fixed' means a theme dependent height of one row (i.e. in Speyside a row is typically 20px high.) In a 'fixed' row all one height unit high elements find their place (like buttons, input fields, one row of text...).
Using px heights is at your own risk, but it is sometimes needed for elements like box or sheet.Alternatively you can give elements a proportion with the * notation.
For example rows="1*;2*" gives the first row 1/3 of the available vertical space and the second row 2/3. This works fine for columns, too.You can group elements with a tc:panel element. Such a panel is interpreted as one element regarding layout. The panel itself can have its own layout for multiple elements inside the panel.
- How do I configure file upload in Tobago?
-
You have two options.
Add a TobagoMultipartFormdataFilter to your web.xml. JavaDoc Description
Add the tobago-fileupload.jar to your project. The tobago-fileupload.jar contains a FacesContextFactory that wraps the multipart-formdata request inside the FacesContext. JavaDoc Description
- Do I need a form tag in a normal Tobago page?
-
The page tag already acts like a form tag. You only need a explicit form tag for partial validation of your data. Please look at the forms example in the Tobago demo
- Which web browsers are currently supported by Tobago?
-
Please take a look at the Compatibility List.
- How do I create my own theme?
-
You have to define a new name for the theme in the META-INF/tobago-config.xml. Choose a fallback theme in the tobago-config.xml. Put the modified resources under the resource-path + theme-name. An example for this is the charlotteville theme. (TODO more details resource handling)
Example layout of a theme jar:
Property and resource loading and renderer loading is done in the following order/META-INF/tobago-config.xml (resource-path/html/theme-name) /org/apache/myfaces/tobago/renderkit/html/xxxxx/standard/style/style.css (standard styles) /org/apache/myfaces/tobago/renderkit/html/xxxxx/standard/style/tobago-menu.css (menu styles) /org/apache/myfaces/tobago/renderkit/html/xxxxx/standard/style/tobago-sheet.css (sheet styles) /org/apache/myfaces/tobago/renderkit/html/xxxxx/msie/style/style.css (different styles for msie)
for example OutRendererresource-path/content-type/theme/client/[tag(for renderer)|property|style|script|image]_locale .(class|property|property.xml|css|js|gif|png...]
org.apache.myfaces.tobago.renderkit.html.scarborough.standard.tag.OutRenderer
OutRenderer is getRendererType() + "Renderer"
The locale handling is handled like the Properties Class.
You have not define everything because the ResourceManager is asking the fallback theme for missing resources
The fallback theme of charlotteville is speyside.
The fallback theme of speyside is scarborough.
The fallback theme of scarborough is standard
The resource manager looks in the case of the charlotteville theme in
charlotteville -> speyside -> scarborough -> standardPlease look at tobago-example-theme
- How do I use and extend the markup attribute?
-
UIBox, UIInput and UIOutput support custom markup with the markup attribute. The supported markup is defined in the tobago-config.xml. The standard markup is defined in tobago-config.xml of the tobago-theme-standard. This can be extended in your own theme. The markup attribute is rendered as a CSS class tobago-[renderer-name.toLowerCase]-markup-[markup]. For an example please look at the markup number and the CSS class tobago-in-markup-number for UIInput in theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css
- In which containers was Tobago tested?
-
Please take a look at the Compatibility List. Feel free to post your own experiences.
- Can Tobago replace Tiles? Can I ignore Tiles and Sitemesh in favor of Tobago?
-
Tobago cannot replace it. But sometimes you may not need it, when you are using Tobago. If you want to position and size your components automatically, you can do this with a Tobago LayoutManager. If you want your header and sidebar rendered without writing duplicate code, you may use JSP 2.0 tag files, Facelets or Tiles/Sitemesh.
- How to configure a maven mirror?
-
If you want to set up a different mirror for some reason, you can use your ~/.m2/settings.xml and add the following lines:
<mirrors> <mirror> <id>mirror ID</id> <name>Give it a name</name> <url>The URL of the mirror</url> <mirrorOf>The server ID of the repository being mirrored. This must not match the mirror ID</mirrorOf> </mirror> </mirrors>Mirrors: List of mirrors
- How do I configure an offline build?
-
If you run into problems with fetching jars from the online repository, you can configure Maven not to fetch them but use the ones already in your local repository by adding the following to your ~/.m2/settings.xml:
<settings> <offline/> </settings>
or use the mvn -o switch.
- How do I perform a local checkstyle check?
-
mvn compile checkstyle:check
- Why my Subversion checkout fails on Windows?
-
One reason is, that the checked out files will have a too long path name.
Under Windows the MAX_PATH is set to 260 characters. When you try to checkout in
a directory like C:\Dokumente und Einstellungen\MyUser\Apache Projects\
the path will be too long. A workaround will be checking out in an other directory
or register a new drive letter and check it out in X:
SUBST X: "C:\Dokumente und Einstellungen\MyUser\Apache Projects\"
- How can I run the Selenium tests?
-
In the tobago-example-test application, the pages can be checked with selenium since Tobago 1.5. To run the full test automatically call
This will start a jetty server and a selenium server and calls every listed page in the test application.mvn -P integration-test
If you want to run the tests from your IDE, please start the jetty with
ormvn jetty:run
and start the selenium server withmvn jetty:run-exploded
Now you can start the selenium tests in the IDE.mvn selenium:start-server
Sometimes there is a problem with Firefox. You may try to use a different version, or an installation without plugins.
- How can I run the Tobago demo with WebSphere Liberty Profile (WLP) from Maven?
-
Please use at least Tobago 2.0 for this guidance (in this version the pom.xml files are prepared).
You will need to do the following steps for preparation:
- Download the server like:
from IBM (Todo: check if this is the correct version)
wlp-developers-runtime-8.5.next.beta.jar
-
Unpack the server anywhere in you file system, e.g. like this
mkdir /opt/wlp-developers-runtime-8.5.next.beta cd /opt/wlp-developers-runtime-8.5.next.beta java -jar ~/Downloads/wlp-developers-runtime-8.5.next.beta.jar -
Adding your server home to a property in the settings.xml of Maven
<wlp.directory>/opt/wlp-developers-runtime-8.5.next.beta</wlp.directory>
After these steps you can start/stop the server and deploy an built artifact. For these steps, you need to be in a Tobago example directory.
cd tobago-examples/tobago-example-demo
-
Start the server
mvn -Pliberty liberty:start-server
-
Build an artifact (you need the "provided" property, because JSF and OWB comes from the server)
mvn package -Djsf=provided
-
Deploy an artifact
mvn -Pliberty liberty:deploy
-
You will find the web application under this URL
http://localhost:9080/tobago-example-demo/
- Redeploy an artifact: The same as deploy.
-
Stop the server
mvn -Pliberty liberty:stop-server
The server starts very fast and is simple to use (very different from the full WebSphere installation). The log files you will find here:
Sometime you may need to the clean the server, in particular when you are changing JAR dependencies. For doing thatcd /opt/wlp-developers-8.5.next.beta/wlp/usr/servers/tobago/logs/
- Stop the server
-
Remove the whole concrete server installation
rm -r /opt/wlp-developers-8.5.next.beta/wlp/usr/servers/tobago
- Start the server
- Deploy again
- Download the server like: