• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with closing script tag

 
Anup Srivastava
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to perform following operation

<script>
function getValue(){
document.form1.brief.value = '<%=briefstr %>';
}
</script>

where "brief" is a hidden variable and "briefstr" is a Java String variable and consists of javascript contents. when javascript inside value closes, that script tag, closes script in my jsp file and gives javascript Error I need to assign these value onload of body for rest of the cose. How can i handle it?
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can not, simply.

JavaScript runs on client side, on the other hand JSP is a server-side technology.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and "briefstr" is a Java String variable and consists of javascript contents.


Do you not thing it might help to show us what that is?

I need to assign these value onload of body for rest of the cose.


"cose"? What's a "cose"?
 
seby mathew
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
remember one thing 'briefstr' is a server side variable, means this is a java variable and it gets initialised in server side, so you have to write some method to manipulate the server side variable (like replace '>' with '>') so that it wont affect your html rendering of the jsp.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic