• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Javascript error "Expected ')' " on rendering the page.

 
Greenhorn
Posts: 3
Spring Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, am getting an js error due to break of the page while rendering the page.

Am getting error at below statement
<input type="radio" name="something" value="something1" onclick="method1(<c:out value='${iter.value1} />' , '<c:out value='${iter.value2}' /> ', <c:out value='${iter.value3}'/> );"

In second parameter if the value has apostrophe character, then we are getting the error.
Am not able to escape it as it is written in the tags:
can you please help me out here.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is JSP source. What we need to see is the rendered HTML at the browser. Do a View Source to see what's been sent to the browser.
 
anjanayya myathri
Greenhorn
Posts: 3
Spring Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
view source has been disabled on the page. any other suggestions...?
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All the latest browsers are equipped with developer friendly tools. just click f12 and verify in the console.you can test and modify the js code from your console try it
 
anjanayya myathri
Greenhorn
Posts: 3
Spring Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its a pop-up window with special previleges, so they have disabled almost all the functionalities for it.
Is ter any replacement for <c: out value="${iter.description}"/> statement. ?
 
bala nannaka
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then you need to escape the html characters from serverside so that apostrophe will not break the js
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OWASP provides an Encoder API where you can escape for various languages including JavaScript.
 
What could go wrong in a swell place like "The Evil Eye"? Or with this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic