wood burning stoves
The moose likes JSF and the fly likes Composite Components Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Composite Components" Watch "Composite Components" New topic

Composite Components

Kevin Weisser

Joined: Aug 24, 2007
Posts: 2
I'm currently looking at creating some components to replace common patterns within my application (name, phone number, ssn, address, etc.), so that a developer need only add one tag to the their JSP instead of dragging several components onto the screen.

I've looked at creating the components in a standard way (obtaining the ResposeWriter and then creating the markup), but cannot seem to figure out how that decode() method would work. In my case, I'm not just trying to run setSubmittedValue() once. I'd need to do that for every input declared within my new component.

I've also looked into using existing components (HtmlInputText) and adding them to a PanelGroup as children, and using the default rendering for a Panel. In this case, getClientId is returning a different value when the constructor runs and when decode() runs.

In both cases, I'm able to get my component to render to the screen. I'm just not able to sucessfully decode the component and set the submitted value.

Has anyone done anything similar to this that would be able to provide me with an example?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

I think you can define a JSP tag that will do that. That is, use the ability of recent versions of the JSP standard to define custom JSP tags in JSP. I'm fairly sure that any J2EE server recent enough to support JSP will also support custom tags written in JSP, and I'm reasonably sure that such tags generally won't interfere with the JSF rendering mechanism.

If you can do that, it would save time over creating everything in Java, and be somewhat tidier as well.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link: http://aspose.com/file-tools
subject: Composite Components
jQuery in Action, 3rd edition