Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Composite Components

 
Kevin Weisser
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18165
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic