This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how can i put java script value into jsp variable?

 
eric lee
Ranch Hand
Posts: 86
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dear sir:
i know how to put jsp value into java script variable
but how to put java script vaule into jsp variable? thanks;

<%
String s="hello",b="";
%>
<script language="javascript">
var name="<%=s%>";
<%b%>=name;<=== is this correct?
</script>
 
Kj Reddy
Ranch Hand
Posts: 1704
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
YOu can put JSP value into JavaScript variable, but reverse is not possible.
Your code dont work.
 
Paul Clapham
Sheriff
Pie
Posts: 20196
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JSP variables exist when the JSP is being processed on the server. At that point the Javascript variables are just markup. Later, when the output of the JSP is processed on the client, the Javascript variables exist but the JSP variables are long gone.

So you can't do that. I would attempt to answer the real question behind your question but I can't tell what it is.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read this article for information on the life-cycle of a JSP and why what you are asking is not possible.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic