This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 60766
    
  65

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: 60766
    
  65

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: send variable
 
Similar Threads
hidden variable?
jsp
RequestDispatcher now working as expected
design issue
How to copy a portion of xsl into a variable