Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Using javaScript Inside JSTL Give Error  RSS feed

 
Syed Ali
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please guide me how to use javascript inside JSTL. i am trying
to use javascript in side a JSTL Loop c:for

<c:forEach items="${blogEntryList}" var="blogEntry">
<cut value="${blogEntry.blogs.BLOG_ID}"/>
<cut value="${blogEntry.TITLE}"/>

<script>
var content = "${blogEntry.BODY}";
var firstLetter = content.substring(0,1);
</script>


<p> <span class="first-letter">
<script> document.write(content.substring(0,1)) </script> </span> <cut value="${blogEntry.BODY}"/> </p>

</c:forEach>


but right now it gives error if i use javascript inside JSTL

thanks
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should start by reading the error message. (You do get error messages, don't you? I assume that was what "gives error" means in your post.) Then take note of when the error occurs. Does it occur when the JSP is running on the server, or is it a Javascript error in the generated page?

All of those things are useful information for you. Note that since we don't know anything about any of them, it's hard for us to say what's wrong. But if you can't solve the problem when you find out what "gives error" means, by all means post information about the error here.
 
Syed Ali
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my question is are we allowed to use javascript <script> </script>
inside a JSTL loop. Is it allowed , because i get javascipt error
when page is displayed on my portal.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JavaScript and JSTL have nothing to do with each other. So yes, it's allowed.

If you are not going to help us help you by giving us details of the error, well...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!