HI there,
I have a bean property 'theDescription' which represents some text submitted by users that I am retrieving from a database. The problem I have is that some submissions contain a URL address within the text...at times very long URL's. It's simple enough to extract the URL using the snippet below:
public static void main(String args[]) {
String theDescription = "some comments http://someurl.com some more comments";
String theURL = "";
Pattern pattern = Pattern.compile("http(.+?)\\s");
Matcher matcher = pattern.matcher(theDescription);
while (matcher.find()) theURL = matcher.group();
System.out.println(theURL);
}
What i need to do is some how display the selected text as a link when my JSF page is rendered.
So ideally it would show as:
some comments
Link some more comments
thanks in advance.