Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!

shashikant shinde

+ Follow
since May 19, 2009
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by shashikant shinde


I am trying to call a javascript function, javascript.sendmail (mailId,mailSubject,mailBody) from my java class.
where I have defined variable mailBody = "Operational Categorization: Provide > Administration %0AProduct Categorization: OFS Business Systems -> Communication & Collaboration";..
but when ii calls that javascript function it gives error saying - "unterminated string literal".

Please suggest me how can I use escape character for %0A or else any better idea.
Hi ,

Thanks for the response. Let me explain my requirement clearly.

I have a java-script method "sendMail('<email-id>', <mailSubject>, <mailBody>)" , inside my jsp file.

I want to display a message, (already using struts), that will contain a "a href" tag, and inside href , this javascript method needs to be referred.

My string message looks like follows:

You don't have administrator rights on 3 out of 84objects concerned,therefore this operation can not be allowed.Please send a mail (<mail referred to javascript:sendMail() using a href >) Hub Admin Support team to carry out this activity for you.

During run-time, this message gets printed in the jsp page, and if the user clicks on "mail" link, one new send mail outlook window needs to be opened, using sendmail() javascript method.

I am trying in the way i posted in the current thread. But, it is not helping me. Please suggest.

Thanks and Regards,

Shashikant Shinde.
now when i am trying with this combination
<a href=\"javascript:sendMail('servicedesk\', mailSubject, mailBody)\">Hub Admin</a>

it is also giving error in eclipse saying Invalid escape sequence.
Hi , I am trying to embed a javascript function in href like follows-

builder.append("<a href='");
builder.append("javascript:sendMail('', mailSubject, mailBody)'>");

but while displaying it is not showing the link HubAdmin . what is the problem??