• 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

Escape Carriage Return

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a tag file where in I am calling one Java function from the Java layer and it returns String. The function which is defined in the Java layer gets populated with the data from the data base. Now when the JavaScript displays the String and if it falls into multiple lines then I am getting the error "Unterminated String Constant". Is there any way I can take care of Carriage return in Java Function at the Java layer or when I call the function at presentation layer (means in tag file).


Thanks,
 
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
What is the purpose of the CRs? Can they just be removed? Or perhaps replaced with \n?
 
Maria Laxmi
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well thats the question , How can I replace with \n when it is coming from the database?

Here is the example how it is used in the tag file.

<script type="text/javascript" LANGUAGE="JavaScript">
var some_text${someClass.id} = "${someClasee.function}";
</script>

Now the SomeClass.function returns long Strings which comes from the database. Only some of the strings falls into multiple lines, not all of them. And those who falls into multiple lines creates a problem. So, this is something dynamic and content related problem and I am not getting the point where and how should I put the \n?

I hope it makes sense.

Thanks for the quick reply !!! I really appreciate it.
 
Bear Bibeault
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
someClasee? Is that different from someClass?

In any case, the getter for the data can simply scrub it as necessary.
 
reply
    Bookmark Topic Watch Topic
  • New Topic