Solved

Clientside variables with Java Server Pages

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

A procedure for exporting installed hotfix details of remote computers using powershell
A Short Story about the Best File Recovery Software – Acronis True Image 2017
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now