jsp动作标记_JSP标准标记(动作元素)

JSP规范提供了一系列标准动作标记,用于从页面中移除不推荐的scriptlet代码。这些标记帮助实现特定任务,如处理Java代码,以提高JSP页面的可维护性和最佳实践。
摘要由CSDN通过智能技术生成

jsp动作标记

JSP specification provides Standard(Action) tags for use within your JSP pages. These tags are used to remove or eliminate scriptlet code from your JSP page because scriplet code are technically not recommended nowadays. It's considered to be bad practice to put java code directly inside your JSP page.

JSP规范提供了在您的JSP页面中使用的标准 (动作)标记。 这些标记用于从JSP页面中删除或消除scriptlet代码,因为目前在技术上不建议使用scriplet代码。 将Java代码直接放在JSP页面内被认为是不好的做法。

Standard tags begin with the jsp: prefix. There are many JSP Standard Action tag which are used to perform some specific task.

标准标记以jsp:前缀开头。 有许多用于执行某些特定任务的JSP Standard Action标记。

The following are some JSP Standard Action Tags available:

以下是一些可用的JSP标准操作标签:

Action TagDescription
jsp:forward

forward the request to a new page

Usage : <jsp:forward page="Relative URL" />

jsp:useBean

instantiates a JavaBean

Usage : <jsp:useBean id="beanId" />

jsp:getProperty

retrieves a property from a JavaBean instance.

Usage :

<jsp:useBean id="beanId" ... />
...
<jsp:getProperty name="beanId" property="someProperty" .../>

Where, beanName is the name of pre-defined bean whose property we want to access.

jsp:setProperty

store data in property of any JavaBeans instance.

Usage :

Where, beanName is the name of pre-defined bean whose property we want to access.

jsp:include

includes the runtime response of a JSP page into the current page.

jsp:plugin

Generates client browser-specific construct that makes an OBJECT or EMBED tag for the Java Applets

jsp:fallback

Supplies alternate text if java plugin is unavailable on the client. You can print a message using this, if the included jsp plugin is not loaded.

jsp:element

Defines XML elements dynamically

jsp:attribute

defines dynamically defined XML element's attribute

jsp:body

Used within standard or custom tags to supply the tag body.

jsp:param

Adds parameters to the request object.

jsp:text

Used to write template text in JSP pages and documents.

Usage : <jsp:text>Template data</jsp:text>

动作标签 描述
jsp:forward

将请求转发到新页面

用法: <jsp:forward page="Relative URL" />

jsp:useBean

实例化一个JavaBean

用法: <jsp:useBean id="beanId" />

jsp:getProperty

从JavaBean实例检索属性。

用法:

<jsp:useBean id="beanId" ... />
...
<jsp:getProperty name="beanId" property="someProperty" .../>

其中, beanName是我们要访问其属性的预定义bean的名称。

jsp:setProperty

将数据存储在任何JavaBeans实例的属性中。

用法:

其中, beanName是我们要访问其属性的预定义bean的名称。

jsp:include

在当前页面中包含JSP页面的运行时响应。

jsp:plugin

生成特定于客户端浏览器的构造,该构造为Java Applets创建OBJECT或EMBED标签

jsp:fallback

如果Java插件在客户端上不可用,则提供备用文本。 如果未加载随附的jsp插件,则可以使用此方法打印消息。

jsp:element

动态定义XML元素

jsp:attribute

定义动态定义的XML元素的属性

jsp:body

在标准或自定义标签中使用以提供标签主体。

jsp:param

将参数添加到请求对象。

jsp:text

用于在JSP页面和文档中编写模板文本。

用法: <jsp:text>Template data</jsp:text>

翻译自: https://www.studytonight.com/jsp/jsp-action-element.php

jsp动作标记

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值