This is just a glimmer, but over the weekend, as part of pushing the Struts 1.3.0-dev code around a bit, I implemented something like this. In a nutshell, here's what I did. I'm hoping that our direction in the core Struts architecture would make it pretty easy for people to put together a package for something like this which could be dropped in to an app nearly wholesale.

First, I wrote a simple plugin which reads an XML file (the help contents) and sets itself up as the expert on "help" in the application context.

As part of the "view processing," I have a command which sets up a "page ID" by copying the path from the current ForwardConfig into the chain context. (Effectively, this is a tiles definition name, but so far it seems to serve as a good ID.)

Then, I have a custom command which checks my "help" plugin to see if it has a "Help" object for the current Page ID. If so, it puts that into the request scope.

In my page, I have some conditional content: if a "Help" object is in scope, then an invisible iFrame is set up with its source as a "Help" JSP which is triggered using the "page ID" as a request parameter. If the user clicks on the link, the iFrame becomes visible and displays the help for the page.

(I used a great recipe from Danny Goodman's "Javascript and DHTML Cookbook" for the pop-up iframe, which is draggable and even is styled to look like an OS-specific window.)

The "Help" JSP actually uses the new feature in Struts 1.3 that allows you to run a commons-chain command as a pre-process to a forward; this command is a chain which actually uses the same two commands from the main process to set up the Page ID and copy the Help into request scope, using a configuration option on the "page ID" command which tells it to use a request parameter instead of the ForwardConfig. Then the action-mapping just forwards directly to the JSP for "help", which is able to get its information from an object in request scope. There's no Action class involved, and I only had to slightly modify my command which established the "page ID" so that it could use either the request parameter or an ActionConfig.

If I say so myself, I think this is a pretty neat example of what we're able to do with the chain based request processor that would have been quite a bit more work to set up automatically for every page in a traditional Struts app.

Joe


At 1:08 PM -0600 2/7/05, Barnett, Brian W. wrote:
I've written a couple of Struts web apps where the only online help was a
help icon next to some strategically chosen fields which when hovered over,
produced some rollover help text. One problem I found with this approach was
that if I wanted to provide help on a bunch of controls, the page got
cluttered with help icons. Another problem is that the help text is now
scattered throughout all my jsp pages, so any future attempt to create a
User's Guide of some kind using the help text, would be difficult.

I'm writing another Struts web app where I'd like a full-blown online help
system. By full-blown, I was thinking of a complete User's Guide that could
be viewed in full in a popup page (easy enough) but also an iframe within
the user's browser, probably in a right side bar, that would show a
context-sensitive section of the User's Guide, based on where the user is in
the app. This iframe could be toggled on or off with a Help icon somewhere
on each page.

I guess I'm wondering if there are some best practices for this sort of
thing in Struts, or if there is a plugin, library, etc., for developing
online help.

Thanks,
Brian Barnett

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to