Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Primefaces link open an email compose window

With JSF-Primefaces how can I make a link on a dataTable column for emailId, such that onclick will open an email compose window? I'm using Primefaces.3.0.M3 with JSF2.

like image 319
lofa in Avatar asked Dec 02 '22 00:12

lofa in


1 Answers

Use the HTML standard mailto: link syntax. You just need to make sure that the generated HTML link ends up to look like

<a href="mailto:[email protected]?subject=Some%20subject&amp;body=Some%20body">mail</a>

This can in JSF be achieved by for example

<h:outputLink value="mailto:#{user.email}">
    <f:param name="subject" value="Some subject" />
    <f:param name="body" value="Some body" />
    <h:outputText value="mail" />
</h:outputLink>

Those links will open the client's default mail composition editor. The subject and body parameters are optional and allows you to set a default subject and body in the email editor.

like image 111
BalusC Avatar answered Dec 16 '22 13:12

BalusC