The excluded parts are scriplets that populate a <select> html menu and write out the HTML for the menu. I am taking a different approach and creating a custom tag to clean up the scriplets. I have the tag created and JSF registers and displays the tag fine. The problem lies in creating the form and commandButton in the custom tag. It seems to output everything fine but when I click on the button the class.method is not called. Below is my code from the custom tag that creates the form and button:
The class used for the action listener is a session level managed bean in JSF. The method is called fine in the JSF code from before I started creating this custom tag, so I know the bean works. My question is, what is going on? What am I forgetting to set or call? Creating custom JSF tags is a bit new for me and I am used to creating custom JSP tags. Either way I am trying to figure this out and any help or suggested links for me to read are appreciated.
Lastly, this is all in MyFaces 1.1.4 on Apache Tomcat. -Nick [ March 11, 2008: Message edited by: Nick Seward ]
Joined: Mar 11, 2008
I managed to figure out most of my problem. I'll post it here in case any one else tries this. First, I wasn't aware that what I am doing is called a composite component pattern.
I still have an issue with setting the action for the HtmlCommandButton. In the old JSF code I have this
The action attribute is set to "go_toc" which is a string for JSF to use when navigating to another page after the button is clicked. Setting this in my composite tag is not easy to figure out. Does anyone know how to do that? There is a setAction(MethodBinding mb) method for HTmlCommandButton but it accepts a method binding and I already have that set by setting the actionListener attribute in my composite tag code. So I don't think setAction is the way to go.
Joined: Mar 11, 2008
So I am guessing nobody has any ideas? I hope this is not a stupid question with the answer staring me right in the face.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Creating HtmlCommandButton and HtmlForm in a custom tag