Hi Ivy Team, I'm managing to create a custom tag in JSF. But it seems not work. Do I need to do something more ?

This is my custom class


@FacesComponent(createTag = true, tagName = "helloComponent", namespace = "http://example.com/tags")
public class HelloComponent extends UIComponentBase {
  @Override
  public String getFamily() {
      return "Greeting";
  }
  @Override
  public void encodeBegin(FacesContext context) throws IOException {
      String message = (String) getAttributes().get("message");
      ResponseWriter writer = context.getResponseWriter();
      writer.startElement("p", this);
      writer.write("Messageeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee: " + message);
      writer.endElement("p");

  }
}

This is my xhtml view : alt text

asked 14.01.2019 at 08:50

tdtin's gravatar image

tdtin
(suspended)
accept rate: 0%

edited 14.01.2019 at 08:53

hi @tdtin Did you create jar lib and put to WEB-INF/libs folder? https://answers.axonivy.com/questions/3488/support-for-facescomponent-within-an-axon-ivy-project-without-putting-jars-into-ivy-web-inf-lib ?

Hi @IvyTeam Is there any way that we can see ivy get trouble when loading lib from that folder? May be the lib have something wrong. Thanks

(15.01.2019 at 01:42) trungdv trungdv's gravatar image

is this not shown in html dialog demos?

(15.01.2019 at 04:07) Alex Suter ♦♦ Alex%20Suter's gravatar image

Hi @Alex Suter, I couldn't find Java FacesComponent Demo in Html dialog demos, can you provide any hint ?

(15.01.2019 at 04:31) tdtin tdtin's gravatar image

Well i am not aware if there any troubleshooting methods at the moment. But I don't recommend to go that way, when you still have to put things in ivy/web/lib. Releasing will be hard.

(15.01.2019 at 10:43) Alex Suter ♦♦ Alex%20Suter's gravatar image

To use the component 2 things are required:

  1. the component must be accessible by the tomcat webapp-classloader: so the compiled class must either:
    • be copied as .class into webapps/ivy/WEB-INF/classes
    • be copied as .jar into webapps/ivy/WEB-INF/libs
  2. furthermore the component must be registered in the webapps/ivy/WEB-INF/faces-config.xml. You will see that our own IvyComponent is also registered there:

    <component> <component-type>IvyComponent</component-type> <component-class>ch.ivyteam.ivy.dialog.execution.jsf.component.IvyCompositeComponent</component-class> </component>

And yes the approach has some limitations:

  • components must be part of your deployment process. So you should have an automated deployment chain with scripts that also deploy and register this component during project deployments.
  • designer requires a full restart before changes in faces-config.xml or changes in compile jar/classes are in effect.
link

answered 22.01.2019 at 04:29

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
9.4k31958
accept rate: 70%

edited 22.01.2019 at 04:34

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×79

Asked: 14.01.2019 at 08:50

Seen: 1,830 times

Last updated: 22.01.2019 at 04:34