-1

I am developing an application using Primefaces 5, and part of the app allows users to post information for example a user posting this >>> "please kim visit www.primefaces.org and reading abt primefaces there". The issues is l want the url to be displyed as a hyperlink when the post is being seen by other users. The bold part in the code below is showing the posted message.

   <div id="postcontent_div"> 
       <h:panelGrid columns="1" style="background-color: #fff;padding-top: 0px;border-bottom: 1px solid #fff"> 
           <p:commandLink styleClass="profilenamelink" ajax="false" value="#{post.username} "/> 
           <h:outputText value="How to master Algorithms" style="font-size: 12px;font-weight:bold;color:black"/> 
       </h:panelGrid> 
       <h:outputText value="#{post.message}" style="font-size: 12px"/> 
  </div>

Mark
  • 16,772
  • 9
  • 42
  • 55
Bento
  • 19
  • 1
  • 8

1 Answers1

0

With primefaces <p:link>. See documentation : http://www.primefaces.org/showcase/ui/button/link.xhtml

With default JSF implementation <h:outputLink> See documentation : http://www.jsftoolbox.com/documentation/help/12-TagReference/html/h_outputLink.html

EDIT :

If you want to parse URL from a String, there are a few methods available. See similar answer : Recognize links in h:outputText

Community
  • 1
  • 1
Thrax
  • 1,926
  • 1
  • 17
  • 32
  • Thank you @Thrax for a quick reply. From the question the user is posting a message with a url inside like "please kim visit www.primefaces.org and reading about primefaces". When displaying the message using the url www.primefaces.org url should be interpreted as a hyperlink automatically but its not happening. how can l go about it?. – Bento Nov 03 '14 at 14:07