Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

JSF page content in OUTLOOK body not getting breaks

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have a requirement. I got a JSF page(parent page). When a button(say SEND EMAIL) is pressed, an email window (OUTLOOK) will be displayed as a popup. I have to populate whatever the text data of parent page as the body of the mail.

I am using mailto method : eg :

Here is my code:
==============
FacesContext context = FacesContext.getCurrentInstance();
HttpServletRequest origRequest = (HttpServletRequest) context.getExternalContext().getRequest();
context.getExternalContext().redirect(String.format("mailto:"+mailTo+"?subject=" + subject +"&body=" + body + "&cc="+mailCc+""));

till here it is fine..

My problem is body part is not getting breaks.
I have tried \n, \t, \r , <br>, <br></br> etc.. what ever stuff i found in google..

for eg my email body looks like below.. it consists of url link also.

====================================================
Hi,

This is to inform you etc... ,
Please follow this Hyperlink link to navigate to your page.. etcc.

regards..

======================================================

Any body help me.
 
Saloon Keeper
Posts: 25466
180
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I hope that this is strictly for in-house users. Outlook doesn't run on my (Linux) desktop, so if you were planning to use this as a part of an app to sell me something, there'd be no sale.

I'm not really sure about this whole forward to "mailto:" anyway. It doesn't make sense to me.

On the other hand, you can use a straight HTML link like this:

<a href="mailto:spam@coderanch.com">Mail me!</a>

You should be able to use the JSF h:outputLink tag to generate that.

The "mailto:" URI scheme works for almost every client/OS combination. In my case, it will bring up the Evolution email client instead of Outlook, but the same general effect will occur. And you'd get your sale.
 
tanveer hyd
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tim,

Thanks for the advise, issue resolved with <a href.. but still is there any way to use <h:commandLink ../> for this issue.

Thanks,
 
Tim Holloway
Saloon Keeper
Posts: 25466
180
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The h:commandLink generates a JSF action method call. It has the visual appearance of a hyperlink, but it navigates like a commandButton, which is a form submit control.

The h:outputLink generates a true hyperlink and doesn't invoke JSF for navigation. Since commandLink doesn't generate a hyperlink, it isn't suitable for non-JSF actions such as "mailto:". That's why there are both commandLink and outputLink controls.

The reason for h:outputLink over a straight "<a>" tag is that the outputLink can emit a URL that's relative to the JSF webapp's URL context instead of requiring the developer to determine what context the app is deployed under and add that information manually. And because JSF is more portable when it avoids using raw HTML.

 
no wonder he is so sad, he hasn't seen this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic