Solved

JSP scriptlets in javascript

Posted on 2006-07-15
8
11,989 Views
Last Modified: 2008-01-09
Hi,
can I have JSP scriplets in a javascript code ?
Thank you.
0
Comment
Question by:matthew016
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 8

Assisted Solution

by:kaliyugkaarjun
kaliyugkaarjun earned 200 total points
ID: 17114120
0
 
LVL 8

Expert Comment

by:kaliyugkaarjun
ID: 17114169
0
 
LVL 4

Expert Comment

by:Meritor
ID: 17114422
It depands on the situation.
Will you describe what excetly you want to do?
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 8

Expert Comment

by:koppcha
ID: 17114749
Usually we end up using expressions in the javascript. But again you need to let us know the situation ,what you are trying to achieve.
0
 
LVL 9

Author Comment

by:matthew016
ID: 17117118
I wanted to affect a jsp variable to a javascript variable.
It is better to avoid this ?
0
 
LVL 8

Expert Comment

by:koppcha
ID: 17117227
You can use expressions. you want to assign a Java script variable to a JSP value right ?
0
 
LVL 9

Author Comment

by:matthew016
ID: 17117270
expressions ?
well js to jsp and jsp to js, i wondered how I could do this.
0
 
LVL 8

Accepted Solution

by:
koppcha earned 300 total points
ID: 17117355
This is an example

<script>

  var arry = new Array();
 //This is a scriptlet
  <%
  String[] strArray = new String[] {"A", "B", "C"};

  for (int i = 0; i < strArray.length; i++) { %>

//This is how the expression are used
  arry[<%=i%>] = "<%=strArray[i]%>";
  <% } %>
  alert(arry.length);

</script>


Relate this to what you are doing and let me know the specific questions that you have
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
reflection example 3 101
iterator example remove 8 74
sortaSum challenge java 17 171
by zero exception 10 39
When we purchase storage, we typically are advertised storage of 500GB, 1TB, 2TB and so on. However, when you actually install it into your computer, your 500GB HDD will actually show up as 465GB. Why? It has to do with the way people and computers…
Knowing where your website is hosted is as important as the features you receive, the monthly fee, and the support you receive. Due diligence should be done when choosing your next hosting provider.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 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