Hello,
I would like to use a button as a link and pass the session variable in a jsp!
The below code should work.
Any help is appreciated.
Thanks.

I use encodeURL if the user has cookies off.
This works with links but not when using an input button with window.location.href.

<input type="button" value="Copy" onClick="window.location.href='<%= response.encodeURL("http://www.mysite/index.jsp?switch="+ intvariable) %>'">

Your quoting seems to be off. Try something like:

<script type="text/javascript">
function redirectUser() {
  var url = '<%= response.encodeURL("http://www.mysite/index.jsp?switch="+ intvariable) %>';
  window.location.href = url;
}
</script>

<!-- more code -->
<input type="button" value="Copy" onclick="redirectUser();">
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.