0
時哪些打開Outlook使用的<h:commandButton>效果
<a href="mailto:[email protected]?subject=Sample subject&body=test&[email protected]">Send mail</a>
這將打開的Outlook郵箱與郵件模板的用戶
相應的JSF代碼預填?
時哪些打開Outlook使用的<h:commandButton>效果
<a href="mailto:[email protected]?subject=Sample subject&body=test&[email protected]">Send mail</a>
這將打開的Outlook郵箱與郵件模板的用戶
相應的JSF代碼預填?
假設您使用的是JSF 1.2或更高版本,則可以在JSF頁面中使用完全相同的HTML代碼。
<a href="mailto:[email protected]?subject=Sample subject&body=test&[email protected]">Send mail</a>
如果你打算基於值預填它形成一個JSF表單,那麼你需要發送重定向到正是URL。
public void submit() throws IOException {
// ...
externalContext.redirect(String.format(
"mailto:[email protected]?subject=%s&body=%s&[email protected]",
URLEncoder.encode(subject, "UTF-8"),
URLEncoder.encode(body, "UTF-8"));
}
請注意,這並不一定會在Outlook中準備郵件。它只是在客戶端自己的默認郵件客戶端中準備郵件,這可能不是Outlook本身。它可能是例如Thunderbird甚至Gmail。另請注意,您有沒有控制該部分。