Tuesday May 30, 2006
Tuesday May 30, 2006
Note: See Using jMaki 9.3 With the NetBeans Visual Web Pack or the Sun Java Studio Creator IDE for updated instructions on how to add jMaki to a project.
In my last blog, I mentioned Greg Murray's jMaki project which enables Java developers to use JavaScript in their Java based applications as either a JSP tag library or a JSF component. Having struggled with the JavaScript part of our Building AJAX-based JavaServer Faces Web Applications With Sun Java Studio Creator hands-on lab, I was excited to learn about a tool that makes the JavaScript part of AJAX technology easier. Geertjan provides a NetBeans module that makes it easy to try out in the NetBeans IDE. I wondered whether I could use jMaki from the Creator IDE, and decided to give it a whirl. Here is how to use jMaki from the IDE.
jmaki.jar
file. If you don't know how to unjar a jar file, one easy way is to rename
it jmaki.zip and unzip it. JmakiDemo.jmaki/jmaki.js to creator-project-dir/web.
jmaki/WEB-INF/types.properties to creator-project-dir/web/WEB-INF.jmaki/WEB-INF/lib/ajax-wrapper-comp.jar to creator-project-dir/web/WEB-INF/lib.
jmaki/resources
to creator-project-dir/web/resources.tree, list, and sudoku
directories. /resources/widget-name. This is how the
jMaki sample app is set up and I chose to put mine in the same place.
Look at the Using jMaki widgets (https://ajax.dev.java.net/page-developer.html)
documentation for alternative locations. xmlns:a="http://java.sun.com/jmaki" to the <jsp:root>
tag. The tag should look similar to this:<jsp:root version="1.2" xmlns:a="http://java.sun.com/jmaki" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:ui="http://www.sun.com/web/ui">
<a:ajax> tag. Even if you were
to use a component from the Pallette, if you wrap the component in an <a:ajax>
tag, the Visual Designer won't see it. To make it easier to work with the
widgets in the Visual Designer, I used a Grid Panel component to help me visualize
where the widgets are on the page.
column property to 2 and set the border
property to 1. By setting the border to 1, it makes it easier to visualize
the page. You can clear the border property when you are ready
to deploy. <a:ajax> wrapper tags are nested
in the <f:verbatim> tags. By nesting the <a:ajax>
tag within an <f:verbatim> tag, you can control its position
in the web page. Otherwise, the rendered output will put the widgets in places
that have no relation to where you positioned the <a:ajax>
tag in the page's JSP. <a:ajax> wrapper tag. <a:ajax> tag should look like for that widget. For
example, for the List widget, I looked at jmaki/list/index.jsp.<f:verbatim/>
with start and ending tags.
<h:panelGrid binding="#{Page1.gridPanel1}"
border="1" columns="2" id="gridPanel1"
style="position: absolute; left: 96px; top: 48px">
<ui:label binding="#{Page1.label1}" id="label1" text="List Widget:"/>
<ui:panelGroup binding="#{Page1.groupPanel1}" id="groupPanel1">
<f:verbatim>
<a:ajax name="list" service="listService.jsp"/>
</f:verbatim>
</ui:panelGroup>
<ui:label binding="#{Page1.label2}" id="label2" text="Tree Widget:"/>
<ui:panelGroup binding="#{Page1.groupPanel2}" id="groupPanel2">
<f:verbatim>
<a:ajax type="dojo" name="tree"/>
</f:verbatim>
</ui:panelGroup>
<ui:label binding="#{Page1.label3}" id="label3" text="Sudoku Widget:"/>
<ui:panelGroup binding="#{Page1.groupPanel3}" id="groupPanel3">
<f:verbatim>
<a:ajax name="sudoku"/>
</f:verbatim>
</ui:panelGroup>
jmaki/web/listService.jsp
to creator-project-dir/web.type attribute set
to dojo. This means that the widget uses the dojo library. So, you have to
copy jmaki/web/resources/dojo to creator-project-dir/web/resources.
Posted by Geertjan on May 31, 2006 at 10:07 AM PDT #
Posted by diva #2 on May 31, 2006 at 11:26 AM PDT #
hi how r u?
Posted by 121.247.142.98 on November 12, 2007 at 11:05 PM PST #
Hi Geertjan
Trying to integrate rich text editor dojo using JMaki in a creator.
Its not working.
Downloaded jmaki-java-1.0.3.zip
from
here
https://ajax.dev.java.net/servlets/ProjectDocumentView?documentID=79239&showInfo=true
Regarding your second point (II)
I cannot find types.properties in that build.
Am I missing something here?
-Vijay
Posted by Vijay on February 06, 2008 at 12:30 PM PST #
Vijay,
This blog was written for a much earlier version of jMaki. They have had major revisions. That is why this no longer works.
I do not have any jMaki 1.x blog entries but you might want to try out my 9.x entries. To see all the entries go to http://blogs.sun.com/divas/tags/jmaki.
To learn more about jMaki 1.x go to www.jmaki.com.
By the way, my name is Chris, not Geertjan.
Posted by Diva #2 on February 06, 2008 at 12:39 PM PST #
Thanks for the response Chris,
Sorry a typo there in addressing you.
Apparently the link
https://ajax.dev.java.net/download-archive.html
lists the older releases but I cannot find the full jMaki v .9 version for download.
Is there any place I can down the full v.9X version?
Posted by Vijay on February 06, 2008 at 01:57 PM PST #
Chris,
Got hold of earlier versions of .9x.
from here
https://ajax.dev.java.net/servlets/ProjectDocumentList?folderID=6632&expandFolder=6632&folderID=0
But in which exact version v .9 x does your blog works?
Posted by Vijay on February 06, 2008 at 02:25 PM PST #
Each of the blog entries gives the exact version. Some are for 9.7 and some are for 9.3.
Posted by Diva #2 on February 06, 2008 at 03:28 PM PST #