Solved

Clientside variables with Java Server Pages

Posted on 2002-03-23
1
210 Views
Last Modified: 2010-04-01
Hello,
I am new to JSP, having been an ASP programmer, and have come across the following problem:

When I am writing clientside Javascript in an ASP page, and I want to refer to a serverside ASP variable, I use the following syntax: "<%=pCounter%>" (quotes are included in the code clientside but not serverside).

ie lstrurl = lstr1 & "<%=pCounter%>"  & lstr2

Is there a similar syntax in JSP??  I have a similar problem in that I want to refer to a serverside JSP variable in my clientside Javascript code, in a JSP page.  All help much appreciated!

Thanks,
Paul Trimming
0
Comment
Question by:Trimtrom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 19

Accepted Solution

by:
cheekycj earned 50 total points
ID: 6892321
actually, what you have is exactly what it would look like in JSP too. :-)

<script>
var lstrurl = lstrul + "<%=JSPVariable%>"
</script>

appends JSPVariable to the ClientSide JavaScript Variable lstrurl.

To learn more about JSPs check out:
http://www.jsptut.com/
http://www.jspin.com/home/tutorials
http://www.1001tutorials.com/java/jsp/index.shtml

HTH,
CJ
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
A look at what happened in the Verizon cloud breach.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

634 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question