Jeremy,

On Fri, Jul 18, 2008 at 04:35:21PM -0500, Jeremy Thomerson wrote:

> Also (just for the archives), you really could override this method on
> WebMarkupContainer - it doesn't actually need to be a "form" instance since
> you're not actually using any form functionality.  You're simply creating a
> container that contains markup, and that you can override attributes of the
> HTML tag on.

You're right; it's definitely simpler with WebMarkupContainer:


public class SearchPanel extends Panel {

    public SearchPanel(String id) {
        super(id);
        add(new WebMarkupContainer("searchForm") {
            @Override
            protected void onComponentTag(ComponentTag tag) {
                // prefix the form "action" attribute with a relative path 
prefix, e.g. "../../"
                tag.put(
                    "action",
                    
RequestCycle.get().getRequest().getRelativePathPrefixToContextRoot()
                    + tag.getAttributes().getString("action"));
            }
        });
    }
}

The onComponentTagBody() override wasn't very clean so it's nice to
eliminate it.

Thanks for the tip!

--Brad


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

Reply via email to