This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSF and the fly likes Open mailtool from a commandButton Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Open mailtool from a commandButton" Watch "Open mailtool from a commandButton" New topic
Author

Open mailtool from a commandButton

Tom Zeiti
Greenhorn

Joined: Feb 16, 2012
Posts: 2
Hello,

I am trying to open an eMail tool (same as typing the URL "mailto:john.doe@web.com" into my web browser) from a commandButton.
I tried things like

<h:commandButton value="send mail" action="#{myBean.email}"/>

and in the bean:

public String email() {
return "mailto:john.doe@web.com";
}

But this gives an error message since, of course, the JSF framework tries to convert the return string into some other address, e.g. adding .xhtml and so on.
How can I avoid that the address is processed in such a way?

Thanks for your help!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950
    
  19

Welcome to the JavaRanch, Tom!

Use the commandLink tag, instead. That will give you what you want.


Customer surveys are for companies who didn't pay proper attention to begin with.
Tom Zeiti
Greenhorn

Joined: Feb 16, 2012
Posts: 2
Yes, using the command link was also what I ended up doing. So I try to figure out how to make the command link look like a button so the user won't notice...
Thanks for your help!
Lars Weje Hangstrup
Greenhorn

Joined: Oct 30, 2012
Posts: 1
Found this:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Open mailtool from a commandButton
 
Similar Threads
help looping through objects
wants to trap email errors
String Validations
Cant retrieve data from use bean
Would a HashSet be a way to solve this problem?