JSP from simple to deep (11) — tag library


JSP 1.1 proposes a method of extending JSP flags, which is named “flag library”. These libraries allow additional flags like jsp:include or jsp:forward, but they are not prefixed with jsp: and they also attach some features.

To introduce the logo library, we use the blazix logo library as an example in this tutorial. This logo library can only be used in the blazix server, which you can download for free.

Each logo library has its own logo library special documents. To use the tag library, you can use “taglib” directive to indicate where the tag library “description” is. For the blazix logo library, the directive is as follows:

<%@ taglib prefix=”blx” uri=”/blx.tld” %>

“URI” in the above sentence indicates the location of the tag library description. The prefix of the flag library is different. This instruction means that we can use blx: to use the flags in the library. The blazix flag library provides a blx:getproperty flag. This flag allows users to edit form data. Now, in getname In the JSP file, we add a jsp:usebean and place the form in blx:getproperty:

<%@ taglib prefix=”blx” uri=”/blx.tld” %>

<jsp:useBean id=”user” class=”UserData” scope=”session”/>



<blx:getProperty name=”user” property=”*”>


What’s your name? <INPUT TYPE=TEXT NAME=username SIZE=20><BR>

What’s your e-mail address? <INPUT TYPE=TEXT NAME=email SIZE=20><BR>

What’s your age? <INPUT TYPE=TEXT NAME=age SIZE=4>






From the above code, we can find that blx:getproperty does not end with / >, but with </blx:getproperty>. This statement inputs all the form input fields into blx:getproperty so that they can be modified correctly by the tag library.

Then create a getname JSP to nextpage JSP, you will find the bean data automatically displayed in the input area. So now the user can edit the data.

Recommended Today

Air quality of major cities in China using Baidu map official website in Vue – Baidu map case code

1. Add in the directory public/index.html <script></script> 2. Add the following code to the page <template> <div id=”MapChart” ref=”MapChart” style=”width: 600px;height:400px;”></div> </template> <script> import * as echarts from ‘echarts’ require(‘echarts/extension/bmap/bmap’) export default { name: ‘MapDemo’, components: {}, props: {}, data () { return { } }, computed: {}, watch: {}, created () {}, mounted () […]