• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with comparing symbol in Javascript

 
Tomas Pytlik
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

i write jspx page and i want to use some Javascript code, something like this:



When I write symbol , then comes error, because JSF thinks, I write tag instead a javascript comparing.

I write in JDeveloper 11g.
 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
put this code in <f:verbatim> tags. Whatever you put inside <f:verbatim> is not parsed. It is passed to the client as it is.
 
Tim Holloway
Bartender
Posts: 18412
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think "verbatim" will help in this case. The tag parser will hit the < and thing that's the end of the tag (it doesn't look that far ahead).

Usually you can use an entity. "&lt;" is the entity that represents "<".

For JavaScript, however, I prefer to use the XML CDATA escape on the entire script. It makes things more readable and you won't get zapped if you miss an entity or someone comes along to change it.

I don't think CDATA works on regular HTML, however. You'd need true XML or XHTML.
 
Tim Holloway
Bartender
Posts: 18412
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tim Holloway:
I don't think "verbatim" will help in this case. The tag parser will hit the < and think that's the end of the tag (it doesn't look that far ahead).

Usually you can use an entity. "&lt;" is the entity that represents "<".

For JavaScript, however, I prefer to use the XML CDATA escape on the entire script. It makes things more readable and you won't get zapped if you miss an entity or someone comes along to change it.

I don't think CDATA works on regular HTML, however. You'd need true XML or XHTML.
 
Tomas Pytlik
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried <f:verbatim>, but Tim is right, it really doesn't work...
 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim for rectifying me.

;)
 
Tomas Pytlik
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is one solution. One must put all javascript code in extern file (for example myjsfunctions.js) and then include it into jspx.



In .js file works everything fine.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!