0

I need to show some text using <h:outputText> tag component. There is this requirement that if the text contains an URLs i.e. http//example.com.co, I need show it as a link.

For example, if user enters Yo quiero www.google.com I need to show Yo quiero www.google.com

Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332

1 Answers1

2

You need a function which does a regular expression replace on your string. You can use string.replaceAll() for this.

You have multiple options to place this function.

  1. You can create a method in your backing bean.
  2. You can create a custom jsf tag (example)
  3. You can create a custom el function (example)

No 1 is the easiest to implement imho.

Community
  • 1
  • 1
David Frank
  • 5,918
  • 8
  • 28
  • 43