Solved

Clientside variables with Java Server Pages

Posted on 2002-03-23
1
206 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
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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

As a business owner, there are many things that keep you up at night. Profit margins, employee retention, human resource protocols, whether your product or service will remain competitive. When you own or manage a technology company that operates la…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

810 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