入门教程:JSP标准模板库(上)_MySQL
简介
JSP标准模板库(JSTL)是SUN公司发布的一个针对JSP开发的新组件。JSTL允许你使用标签(tags)来进行JSP页面开发,而不是使用多数JSP程序员已经习惯了的scriptlet代码方式开发。JSTL几乎能够做到传统JSP scriptlet代码能做的任何事情。你可能会疑惑,为什么我们需要另一种这样的HTML生成语言呢?
STL允许JSP程序员使用tags而不是JAVA代码来编程。为了展示为什么这个是更优越的,下面将给出示例。我们会检查一个非常简单的从1数到10的JSP页面。我们将通过两种方法来检查,一种是基于JSP的scriptlet,一种是JSTL。当这个计数器页面的例子是用JSP scriptlet来编写时,JSP页面如下所示:
for(int i=1;i {%>
}
%>
正如你在上例中看到的看到的那样,使用scriptlet代码产生的页面源代码会包含混合的HTML标签和JAVA语句。这种混合型的编程方式不是最佳的方式,其主要原因有以下几点。
主要的原因是它的可读性。这个可读性主要依赖于人类和计算机。JSTL可以允许程序员查看一个只包含完整HTML和类似HTML的标签的页面。
SP scriptlet代码的可读性不适合人类。这种混合的scriptlet和HTML代码对于计算机来说也很难读。尤其是针对那些HTML官方工具如Dreamweaver和Microsoft FrontPage,所表现出来的不直观性更突出。目前,大多数HTML官方工具会以不可编辑块(non-editable blocks)的形式来隔离JSP scriptlet代码。这种HTML官方工具通常是不能直接修改JSP scriptlet代码的。
下面这段代码展示这个计数器范例如何使用JSTL方式来编写。正如你所看到的,这个代码列表有不变性,仅仅一个标签被使用。HTML和JSTL标签混合起来产生了这个程序。
当你检查上面这个例子的代码时,你会看到,JSP页面只包含标签。上面的代码使用诸如和
这样的HTML标签。这种标签用法不限制于HTML标签。这段代码也可以使用诸如
安装JSTL
要使用JSTL,你必须安装有一个JSP1.2(或者更高版本)的容器。最普通的JSP容器是Apache Tomcat。你能够从 http://jakarta.apache.org/tomcat/ 这里下载到。独立的Tomcat允许你使用常规的JSP scriptlet代码。要使用JSTL,你必须在Tomcat中安装JSTL。JSTL的主要URL是 http://java.sun.com/products/jsp/jstl/ 。要使用JSTL,必须解压这个文件,然后将它安装到Tomcat的正确位置。
完成上面这三步后,你现在可以准备测试你的JSTL安装了。可以通过创建一个包含JSTL的JSP页面来验证。一个最简单的范例程序就是上面的那个计数器程序。你应该将它放置在你的Webroot目录中(C:\Program Files\Apache Tomcat 5.0\webapps\ROOT)。一旦Tomcat启动后,你应该能够通过浏览 http://127.0.0.1:8080/count.jsp 来查看这个页面。
如果你没有正确安装JSTL,那么可能不会出现错误信息。如果JSTL不能解释你的标签含义,那么它在Web浏览器上会直接跳过。然后Web浏览器将解释这些未知的HTML标签。多数浏览器仅仅只是忽略这些未知的HTML标签。
To be continued......
Translated by Caiyi0903(Willpower),2004.2.19

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Kimi: In just one sentence, in just ten seconds, a PPT will be ready. PPT is so annoying! To hold a meeting, you need to have a PPT; to write a weekly report, you need to have a PPT; to make an investment, you need to show a PPT; even when you accuse someone of cheating, you have to send a PPT. College is more like studying a PPT major. You watch PPT in class and do PPT after class. Perhaps, when Dennis Austin invented PPT 37 years ago, he did not expect that one day PPT would become so widespread. Talking about our hard experience of making PPT brings tears to our eyes. "It took three months to make a PPT of more than 20 pages, and I revised it dozens of times. I felt like vomiting when I saw the PPT." "At my peak, I did five PPTs a day, and even my breathing was PPT." If you have an impromptu meeting, you should do it

In the early morning of June 20th, Beijing time, CVPR2024, the top international computer vision conference held in Seattle, officially announced the best paper and other awards. This year, a total of 10 papers won awards, including 2 best papers and 2 best student papers. In addition, there were 2 best paper nominations and 4 best student paper nominations. The top conference in the field of computer vision (CV) is CVPR, which attracts a large number of research institutions and universities every year. According to statistics, a total of 11,532 papers were submitted this year, and 2,719 were accepted, with an acceptance rate of 23.6%. According to Georgia Institute of Technology’s statistical analysis of CVPR2024 data, from the perspective of research topics, the largest number of papers is image and video synthesis and generation (Imageandvideosyn

After rain in summer, you can often see a beautiful and magical special weather scene - rainbow. This is also a rare scene that can be encountered in photography, and it is very photogenic. There are several conditions for a rainbow to appear: first, there are enough water droplets in the air, and second, the sun shines at a low angle. Therefore, it is easiest to see a rainbow in the afternoon after the rain has cleared up. However, the formation of a rainbow is greatly affected by weather, light and other conditions, so it generally only lasts for a short period of time, and the best viewing and shooting time is even shorter. So when you encounter a rainbow, how can you properly record it and photograph it with quality? 1. Look for rainbows. In addition to the conditions mentioned above, rainbows usually appear in the direction of sunlight, that is, if the sun shines from west to east, rainbows are more likely to appear in the east.

We know that LLM is trained on large-scale computer clusters using massive data. This site has introduced many methods and technologies used to assist and improve the LLM training process. Today, what we want to share is an article that goes deep into the underlying technology and introduces how to turn a bunch of "bare metals" without even an operating system into a computer cluster for training LLM. This article comes from Imbue, an AI startup that strives to achieve general intelligence by understanding how machines think. Of course, turning a bunch of "bare metal" without an operating system into a computer cluster for training LLM is not an easy process, full of exploration and trial and error, but Imbue finally successfully trained an LLM with 70 billion parameters. and in the process accumulate

Editor of the Machine Power Report: Yang Wen The wave of artificial intelligence represented by large models and AIGC has been quietly changing the way we live and work, but most people still don’t know how to use it. Therefore, we have launched the "AI in Use" column to introduce in detail how to use AI through intuitive, interesting and concise artificial intelligence use cases and stimulate everyone's thinking. We also welcome readers to submit innovative, hands-on use cases. Video link: https://mp.weixin.qq.com/s/2hX_i7li3RqdE4u016yGhQ Recently, the life vlog of a girl living alone became popular on Xiaohongshu. An illustration-style animation, coupled with a few healing words, can be easily picked up in just a few days.

Retrieval-augmented generation (RAG) is a technique that uses retrieval to boost language models. Specifically, before a language model generates an answer, it retrieves relevant information from an extensive document database and then uses this information to guide the generation process. This technology can greatly improve the accuracy and relevance of content, effectively alleviate the problem of hallucinations, increase the speed of knowledge update, and enhance the traceability of content generation. RAG is undoubtedly one of the most exciting areas of artificial intelligence research. For more details about RAG, please refer to the column article on this site "What are the new developments in RAG, which specializes in making up for the shortcomings of large models?" This review explains it clearly." But RAG is not perfect, and users often encounter some "pain points" when using it. Recently, NVIDIA’s advanced generative AI solution

Since the launch of ChatGLM-6B on March 14, 2023, the GLM series models have received widespread attention and recognition. Especially after ChatGLM3-6B was open sourced, developers are full of expectations for the fourth-generation model launched by Zhipu AI. This expectation has finally been fully satisfied with the release of GLM-4-9B. The birth of GLM-4-9B In order to give small models (10B and below) more powerful capabilities, the GLM technical team launched this new fourth-generation GLM series open source model: GLM-4-9B after nearly half a year of exploration. This model greatly compresses the model size while ensuring accuracy, and has faster inference speed and higher efficiency. The GLM technical team’s exploration has not

On July 24, Kuaishou video generation large model Keling AI announced that the basic model has been upgraded again and is fully open for internal testing. Kuaishou said that in order to allow more users to use Keling AI and better meet the different levels of usage needs of creators, from now on, on the basis of fully open internal testing, it will also officially launch a membership system for different categories of members. Provide corresponding exclusive functional services. At the same time, the basic model of Keling AI has also been upgraded again to further enhance the user experience. The basic model effect has been upgraded to further improve the user experience. Since its release more than a month ago, Keling AI has been upgraded and iterated many times. With the launch of this membership system, the basic model effect of Keling AI has once again undergone transformation. The first is that the picture quality has been significantly improved. The visual quality generated through the upgraded basic model
