Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

There are three different approaches to adding or updating a Components HTML attributes.

...

Code Block

...

// this can be any Component
new TextField("my-text-field", myModel){

	@Override
	protected void onComponentTag(final ComponentTag tag){
		super.onComponentTag(tag);
		tag.put("onmouseover", "foo();return false;");
	}
};

...

...

Code Block

...

new TextField("my-text-field", myModel).add(new AbstractBehavior(){
			
	@Override
	public void onComponentTag(Component component, ComponentTag tag) {
		tag.put("onmouseover", "foo();return false;");
	}
});

...

...

see How to modify an attribute on a HTML tag