Meaningless Drivel is fun!*
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 Android Security Essentials Live Lessons this week in the Android 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: 15964
    
  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:

 
jQuery in Action, 2nd edition
 
subject: Open mailtool from a commandButton
 
Similar Threads
help looping through objects
Would a HashSet be a way to solve this problem?
Cant retrieve data from use bean
wants to trap email errors
String Validations