Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Clientside variables with Java Server Pages

Posted on 2002-03-23
1
Medium Priority
?
215 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 150 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

963 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