wood burning stoves*
The moose likes JSP and the fly likes send variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "send variable" Watch "send variable" New topic
Author

send variable

Bacchi Gerem
Ranch Hand

Joined: Jan 23, 2004
Posts: 120
Hi,
How can i send variable from javascript to jsp.


Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

That greatly depends upon what you mean by "send". Please read this.

Do you mean as part of a form submission?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bacchi Gerem
Ranch Hand

Joined: Jan 23, 2004
Posts: 120
How can i send variable a to jsp page :

code :

function callEdit(key)
{

var a = document.user.tempId.value=key;
alert(a);
document.user.action="http://localhost:8084/Struts_Contract_Entry/jsp/mysql.jsp?edit=a"
document.user.submit();
}





Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

Ah, you want to send it as a request parameter on the query string. This is the sort of detail that should have been provided in the first post.



This will append the value of a to the URL after properly encoding it.
Bacchi Gerem
Ranch Hand

Joined: Jan 23, 2004
Posts: 120
Thank You. I got it.
 
 
subject: send variable