Skip to Navigation | Skip to Content



Archive for April, 2007

More java goodness | April 19th, 2007

So as promised, here is some more Java love in the form of an Eclipse plugin and a Struts 2 plugin.

Files
Eclipse Plugin 0.8 (This is plugin uses the trial versions of the components)
Struts 2 Plugin 0.8
Nitobi Taglib 0.8 (some small kinks worked out)
Nitobi Server Library 1.0.1 (This updated library (used to be called nitobicomponents.jar) is needed for the Struts 2 plugin)

Eclipse Plugin
This plugin is built on top of WTP (1.5.3) extension points and provides some custom project facets when creating a new Dynamic Web Project. It will copy over the needed script and style files to resources/nitobi/script and resources/nitobi/style in the root of your web content directory. It’ll also copy over the Nitobi Taglib and Nitobi Server Library jars to your project build path.

We’ve also added some contributions to the Snippet palette. Dragging a snippet to an open editor will insert a small, demonstrative declaration that will usually render without modification. I say “usually” because of course you’ll need to do some lifting of your own if you want to have the component bound to remote data.

Struts 2 Plugin
I put up a knowledgebase article on using Grid in Struts 2 and I realised while writing it that we could help simplify the process. So I put together a simple, but hopefully useful plugin which provides a Nitobi result type.

To use the result type, you need to declare a package in your struts.xml file that extends “nitobi-default” and your get handler action needs to specify a result type of “nitobi”. Par example:

<struts>
  <package name="grid" extends="nitobi-default">
    <action name="gethandler" class="example.GetHandlerAction">
      <result name="success" type="nitobi">
        <param name="encoding">UTF-8</param>
        <param name="handlername">gethandler</param>
      </result>
    </action>
  </package>
</struts>

Note that the result can take two optional parameters: encoding and handlername. The encoding attribute is used to set the encoding of the response. The handlername attribute is the name of your Action’s GenericGetHandler/GenericSaveHandler member variable that the Result will look for in the Value Stack. So, if in your Action you have a GenericGetHandler declared as such:

// You also need to declare a public getter for this member
// to make it available to the Result on the Value Stack.
GenericGetHandler monHandler;

You need to specify this using the handlername parameter. By default, encoding will be set to UTF-8 and handlername is set to handler.

There may be some kinks yet to work out so bear with me! We’ve got some improvements to the server library on tap and hopefully a NetBeans module too. Again, any feedback on this stuff would be most appreciated and will be reciprocated with a virtual, yet vigorous, high-five.

Posted in eclipse, java, struts2 | 1 Comment » | Add to Delicious | Digg It

Taglib Addendum | April 14th, 2007

I just wanted to quickly point out a small difference between the new taglib we introduced last week and our regular, non-jsp tags. Most of the tags look the same, but for unbound Grids and ComboBoxes, the data elements are a bit different. For the taglib, instead of specifying data as attributes, there is a single data attribute that takes a JSON object. For example, the <e> element looks like this in the taglib:

<n:e data="{'xi' : '0',
             'a' : 'Mick Jones',
             'b' : 'Topper Headon',
             'c' : 'Joe Strummer',
             'd' : 'Paul Simonon'}"></n:e>

And for those who are interested, there are new articles in the KB describing how to set up a databound Grid in Struts 1 and Struts 2.

Posted in java | 1 Comment » | Add to Delicious | Digg It


Search Posts

You are currently browsing the Mike’s Blog weblog archives for April, 2007.


My ideal work culture:
[See my summary] [What's yours?]

Archives

Categories