简体   繁体   English

嵌入html且大于/小于符号的Javascript

[英]Javascript embedded in html and greater / less than signs

Long time ago I faced a problem with embedding too much JavaScript inside the html page in <script> tags. 很久以前,我在<script>标记的html页面内嵌入太多JavaScript时遇到了一个问题。 The JavaScript had lots of < and > signs and it was somehow conflicting with the actual page html tags. JavaScript具有许多<>符号,并且在某种程度上与实际的页面html标签冲突。

I am now unable to recreate this. 我现在无法重新创建它。 How can this possibly happen? 这怎么可能发生? Or are the browsers now a bit more intelligent in handling embedded JavasSript? 还是现在的浏览器在处理嵌入式JavasSript方面更智能?

I just came across this issue, however, not in a browser , but in an IDE - JBoss Developer Studio (which is a variant of Eclipse IDE) 但是,我只是在一个浏览器中遇到了这个问题,而不是在一个IDE中-JBoss Developer Studio(这是Eclipse IDE的一个变体)

在此处输入图片说明

When i run the application in the browser (its a Java Enterprise application, running on JBoss web server), i get the same error as in the IDE : The content of elements must consist of well-formed character data or markup. 当我在浏览器中运行该应用程序(它的Java Enterprise应用程序,在JBoss Web服务器上运行)时,出现与IDE中相同的错误:元素的内容必须包含格式正确的字符数据或标记。 While modern browsers have solved this issue, embedding javascript code in a JSF page (Java Server Faces) , as i did, still hits the same problem. 尽管现代浏览器已经解决了这个问题,但是像我一样,将JavaScript代码嵌入JSF页面(Java Server Faces)中仍然遇到相同的问题。 Perhaps you might want to give it a try: create a simple JSF application, embed the javascript, run it on a Java web server like JBoss 也许您可能想尝试一下:创建一个简单的JSF应用程序,嵌入javascript,在Java Web服务器(如JBoss)上运行它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM