You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Matthias Kahlau <mk...@web.de> on 2006/03/19 11:34:12 UTC

mailto outputLink with session id problem

Hi!


I use the standard outputLink action for a mailto link. The problem is that
JSF adds the session id to the mailto URL. Do you know if it's possible to
prevent this?

Thanks.

-Matthias



Re: mailto outputLink with session id problem

Posted by janw <ja...@gmx.de>.
I found a workaround that is sufficient for me.

The mailto-Link is created by Javascript:

function openMailto(body, subject){
  this.location.href="mailto:?body=" + body + "&subject=" + subject;
}


The JS is called on the onmousedown event on a commandbutton:

<h:commandButton id="..." immediate="true"
  onmousedown="openMailto('#{myBean.body}','#{myBean.subject}');"
  onclick="return false;" image="/images/image.gif"/>

Jan
-- 
View this message in context: http://www.nabble.com/mailto-outputLink-with-session-id-problem-tf1305834.html#a5489075
Sent from the MyFaces - Users forum at Nabble.com.


Re: mailto outputLink with session id problem

Posted by janw <ja...@gmx.de>.
...sorry, the last line should be:

Is it possible to store the the row-specific body of the mail in a variable
and access it from the a-tag? 

Jan
-- 
View this message in context: http://www.nabble.com/mailto-outputLink-with-session-id-problem-tf1305834.html#a5481083
Sent from the MyFaces - Users forum at Nabble.com.


Re: mailto outputLink with session id problem

Posted by janw <ja...@gmx.de>.
Hello,

is there by now a common solution for this problem?
In a datatable I tried a workaround by using the verbatim tag, but inside I
cannot use EL, thus cannot access the row-specific variable.

            <f:verbatim>
              < a id="mailto_link"
               
href="mailto:?subject=SomeSubject&amp;body=#{var.myProperty}"
                style="color:black;"> Send Mail
              < /a>
             </f:verbatim>

The body of the mail will contain the string #{var.myProperty}
Is it possible to store the the row-specific body of the mail in a variable
and access it from the  -tag?

Regards
Jan
Andrew Robinson-5 wrote:
> 
> Probably not. I just had a similar issue. According to the servlet
> specification, a browser that doesn't have cookies enabled must have
> all encoded URLs appended with the session ID in ";JSESSIONID="
> fashion. According to the JSF specification, the encodeResourceURL is
> required to call the HttpServletRequest.encodeURL. This is the method
> that is required to append the JSESSIONID.
> 
> In my solution, I had a custom component, so I just stopped calling
> "encodeResourceURL", but with outputLink, I know of no such solution
> without overriding it. Perhaps there is something in the servlet
> specification of some switch you can add to your web.xml to stop this
> feature. I'm not sure (I stopped looking when I found a workaround).
> 
> Good luck,
> Andrew
> 
> On 3/19/06, Matthias Kahlau <mk...@web.de> wrote:
>> Hi!
>>
>>
>> I use the standard outputLink action for a mailto link. The problem is
>> that
>> JSF adds the session id to the mailto URL. Do you know if it's possible
>> to
>> prevent this?
>>
>> Thanks.
>>
>> -Matthias
>>
>>
>>
> 
> 
-- 
View this message in context: http://www.nabble.com/mailto-outputLink-with-session-id-problem-tf1305834.html#a5481012
Sent from the MyFaces - Users forum at Nabble.com.


Re: mailto outputLink with session id problem

Posted by Andrew Robinson <an...@gmail.com>.
Probably not. I just had a similar issue. According to the servlet
specification, a browser that doesn't have cookies enabled must have
all encoded URLs appended with the session ID in ";JSESSIONID="
fashion. According to the JSF specification, the encodeResourceURL is
required to call the HttpServletRequest.encodeURL. This is the method
that is required to append the JSESSIONID.

In my solution, I had a custom component, so I just stopped calling
"encodeResourceURL", but with outputLink, I know of no such solution
without overriding it. Perhaps there is something in the servlet
specification of some switch you can add to your web.xml to stop this
feature. I'm not sure (I stopped looking when I found a workaround).

Good luck,
Andrew

On 3/19/06, Matthias Kahlau <mk...@web.de> wrote:
> Hi!
>
>
> I use the standard outputLink action for a mailto link. The problem is that
> JSF adds the session id to the mailto URL. Do you know if it's possible to
> prevent this?
>
> Thanks.
>
> -Matthias
>
>
>