Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
javascript friendly replacement for ' character available?

on my xpage I set a javascript variable onload:

var custName = '#{javascript: matterBean.getMatter().getCustomer().getCustName();}';

this variable I use to replace later the title of a bootstrap dialog.

I notice names with the ' character in it break the code.

I could replace it with

var custName = "#{javascript: matterBean.getMatter().getCustomer().getCustName();}";

but then this would break if the name contains the " character.

Is there an alternative, a javascript friendly replacement so the back-end code (java) could return a javascript friendly replacement for the ' character?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You can use Apache Commons StringEscapeUtils for escaping the string. Example:

StringEscapeUtils.escapeJavaScript(str);
about 4 years ago · Juan Pablo Isaza Report

0

StringEscapeUtils.escapeJavaScript(str);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!