HTML 标记(HTML tag)
我正在阅读Servlet“HellowWorld”教程。 servelet在HelloWorldServelet.java类中定义。 超级简单的输出“地狱世界”消息到客户端请求。 唯一的html文件是下面的“index.html”。 我不明白元标记是如何工作的。 当我在Web服务器中运行该应用程序时,它会自动将此页面与URL一起使用:
HTTP://本地主机:8080 /的HelloWorld /的HelloWorld
属性“http-equiv”和“content”如何与servelet一起工作?
<html> <head> <meta http-equiv="Refresh" content="0; URL=HelloWorld"> </head> </html>
I am reading a Servlet "HellowWorld" tutorial. The servelet is defined in a HelloWorldServelet.java class. Super simple to output "Hell world" message to the client request. The only html file is "index.html" below. I don't understand how the meta tag works. As I run the application in the web server, it automatically this page with the URL:
http://localhost:8080/helloworld/HelloWorld
How the attributes "http-equiv" and "content" work together with the servelet?
<html> <head> <meta http-equiv="Refresh" content="0; URL=HelloWorld"> </head> </html>
最满意答案
Refresh
元标记会自动将浏览器重定向到指定时间后给定的URL。如果没有看到您正在使用的教程,我无法想象为什么您需要将它用于您的任务。
The
Refresh
meta-tag automatically redirects the browser to the URL given after the specified amount of time.Without seeing the tutorial you are using, I can't imagine why you would need to use it for your task.
相关问答
更多-
如何从静态HTML页面读取数据,例如元标记?(How can I read data from my static HTML page, such as the meta tag?)[2021-10-13]
@onetwothree - 如果你只是想访问它的内容,它将是这样的。 export class MyComponent implements OnInit{ private appVersion:string; constructor(){ this.appVersion = ""; } // Runs on component creation ngOnInit(){ this.appVersion = this.getMetaDat ... -
HTML:元描述标签的用途(HTML: Meta description tag's uses)[2022-08-16]
对于内部网站,没有理由添加description元标记。 这确实适用于搜索引擎的使用,所以除非你使用内部搜索引擎(比如谷歌迷你 ),这完全是不必要的。 从维基百科 - 描述属性 : description属性提供了网页内容的简要说明。 这样,如果搜索引擎无法根据页面内容自动创建自己的描述,则网页作者可以为列表提供比可能显示的更有意义的描述。 (强调我的) For an internal site there is no reason to add a description meta tag. It is ... -
您可以使用正则表达式替换您的html标记。 例如, string myContent = Regex.Replace(description, @"<(.|\n)*?>", string.Empty); 或者 - 你可以使用.Net 4.0+的WebUtility.HtmlDecode和旧版本的HttpUtility.HtmlDecode 。 希望能帮助到你 :) You can use regex to replace your html tags. For example, string myCont ...
-
在任何规范中都没有定义(包括HTML5草案 ) 这是一个可怜的人的版本的一个真正的HTTP标题,应该真的在标题中表达。 例如: Content-language: es Content-type: text/html;charset=UTF-8 它表示,该文件是面向西班牙语的人士(但这并不意味着该文件用西班牙语写成,例如,它可 ...
-
标签必须始终被标签关闭符号> (如果我们忽略某些SGML规则,名义上应用于非XHTML HTML但从未在浏览器中实现)。 你的意思是要求这些元素是否需要由结束标签来关闭。 答案是非XHTML HTML(包括HTML序列化中的HTML5), meta标签和link元素不需要或允许使用结尾标签。 然而,实际上,如果您使用浏览器,那么浏览器只会忽略它们的显式结束标记,以及货物崇拜/之前的。 而且,即使正式允许/在HTML序列化中,HTML5也使得这种允许性成为规则。 在XHTML中,XML规则适用,所以每个元素无 ...
-
HTML5:验证未注册的标记的“正确”行为是什么?(HTML5: What is the “correct” behavior for validation of unregistered tags?)[2022-02-24]
实际上,只要保留元标记就可以了。 即使验证者抱怨,它也不会对任何使用您网站的人产生任何影响。 In practice, just leave the meta tags as they are. Even if the validator complains, it doesn't make a single bit of difference to anyone using your website. -
你如何检查是否存在使用JavaScript的HTML元标记?(How do you check if a html Meta tag exist using JavaScript?)[2022-03-31]
它将始终返回true,因为querySelectorAll在0匹配的情况下返回一个空数组。 文档 您可以使用NodeList对象的length属性来确定与指定选择器匹配的元素的数量 尝试这个: if (document.querySelectorAll('meta[content="This is not an apple"]').length > 0) { alert('Its here!'); } else { alert('Its not here') } ... -
Razor对html进行编码以防止xss攻击。 所以你必须明确告诉剃须刀不要编码html标签。 而不是@Html.Raw(robots) @robots你会在这里使用@Html.Raw(robots) 有关xss预防的更多信息可以在这里找到 Razor encodes html to prevents xss attacks. So you'll have to explicity tell razor not to encode the html tags. Instead of @robots you' ...
-
EJS可能是最简单的,与PHP非常相似。 您还可以使用Mustache和Handlebars查看其他选项,只需对现有HTML进行最少的更改。 与EJS: <%= yourMetaTags %> ... 与胡子: {{ yourMetaTags }} ... 使用把手: {{ yourMetaTags }} ... doT.js也非常快。 看到: http://www.embeddedjs.com/ https://mustache.gi ...
-
HTML 标记(HTML tag)[2022-04-28]
Refresh元标记会自动将浏览器重定向到指定时间后给定的URL。 如果没有看到您正在使用的教程,我无法想象为什么您需要将它用于您的任务。 https://en.wikipedia.org/wiki/Meta_refresh The Refresh meta-tag automatically redirects the browser to the URL given after the specified amount of time. Without seeing the tutorial you a ...