在JSP上自动生成下拉菜单的设计外文翻译资料

 2022-12-19 05:12

The design of automatically generating drop-down menu on JSP

Abstract:

Drop-down menu is widely used in webpage to limit the format or content that the users input. It is conveniences if the contents of drop-down list are fixed while there has no dynamically menu label at present. A JSP custom tag is introduced in this paper, in which the drop-down menu can extract data from database to generate options dynamically. The custom tag has strong practice in practical applications.

Published in: 2012 International Conference on Computer Science and Information Processing (CSIP)

Date of Conference: 24-26 Aug. 2012

SECTION 1.

Introduction

The drop-down menus are often used in webpage to select items. If the designer want to limit the user inputting content when he design the webpage, he often using drop-down menu which allowing the user to select the options drop-down menu list, instead of the user inputting according to their own will. The advantage of using the drop-down menu is unifying the enter data format, convenient programming; restricting the scope of input data and so on.

However, the options of drop-down menu are fixed, while in some software applications, a problem is often encountered to: How to deal with if the practical application need to be deleted or added an option in the drop-down menu? Can we increase the software a function — the dynamic generated options of drop-down menu?

JSP is one of a mainstream dynamic webpage design languages, and it is a design standard of dynamic webpage now. The JSP tag, is a group of webpage labels which similar to HTML ones. We can easily achieve some functions we need in the webpage by using JSP tags. However, in addition to the JSP general tag library, we can program custom tag to realize user personalized demand.

SECTION II.

The technology analysis of JSP custom tag

A The function and structure of JSP tag

JSP is actually a combination of HTML and JAVA technology. The separation between presentation layer and business layer is very important in project program design. Therefore, it is necessary try to unapparent Java program code in webpage. But in the face of the increasingly complex needs the reality and the presentation layer is required to complete some complex functions so that needing a new technology to achieve, and then JSP tag is born.

We can easily achieve a no script design environment by using the tag library. The label camouflages Java code as XML or HTML tags to replace Java script.

For example, We can easily realize Java option code in the JSP page by using.“ if, elseif, else” tag.

With the code above, we can realize the function in the page that displaying different content according to the different school value

B. JSP custom tag

With the continuous raising of modern software requiring, the JSP standard tag library has been unable to meet the needs of software development, custom tags can achieve a variety of personalized needs.

By using the technology of custom tag, we can increase the JSP function unlimited, we can make all the webpage of the project uniformly, and we can increase the reusability of the code.

Custom tag design contains the following parts:

  • JavaBean, it is the based portion of program code of tag library;
  • Tag library configuration file (TLD): TId file is a abbreviation of lsquo;taglib definationrsquo;, it is also the definitions of the tag. The file defines the tag using: how to load the Java code of the tag, and the tag how to work.

In addition to this, the tag must be configured in the lsquo;web.xmlrsquo; file.

SECTION III.

DYNAMIC DROP-DOWN MENU REALIZATION

I had completed a custom tag named dropDownMenu in the project lsquo;Head Teacher System. Its function is generating drop-down menu options according to the DataBase table dynamically. The options of drop-down menu are come from one DataBase table. When the data of the table is changed, we dont need modify the drop-down menu on every page, because the drop-down menu will be modified itself.

C. The realization of downDropMenu tag Java code

The following is the part of java code to realize DownDropMenu Tag.:

D. The configuration of downDropMenu tag

To make the custom tag libraries reuseful, we need to configure the TLD file and the web.xml file.

bull; To configure TLD file

Tag TLD is the abbreviation of lsquo;taglib definationrsquo;, which is also the taglib definition. This file defines the use of tag, and how to load Java code, and the tag how to work. In this system, TLD called ddm. tld, here is the code for it:

In JSP, the attribute is interpreted to be a variable of Java class, which value can be accessed implicitly. It can be used directly, that is to say, if the tag is specified that lsquo; tableName = studenetrsquo;, DownDropMenuTag will get the value from the student table automatically, and the value can be used directly. That means you can increase the attribute to the tag arbitrarily. Ddm. tld needs to be placed in the directory of WEB-INF, to ensure the compiled DownDropMenuTag class can be accessed to the JSP container.

C. Application of downlDropmenu tag

We must add the pre-compiled instruction following in the beginning of JSP page:

lt; taglib prefix = “ ddm” URI = /WEB -INF/ddm.tld” % gt;

According to the instruction, the compiler will find all the tag beginning with lsquo;ddmrsquo; in web.xml. Then we need to add the tag we needed in the desired position. When the tag is instantiated, the doStartTag process will be executed automatically. The options of drop-down menu will be displayed the information inside the table.lt;

剩余内容已隐藏,支付完成后下载完整资料


在JSP上自动生成下拉菜单的设计

摘要:

下拉菜单广泛应用于网页,用以限制用户输入的格式或内容。如果没有动态菜单标签,固定下拉列表的内容也是很容易实现的。本文介绍了JSP自定义标签,其中下拉菜单可以从数据库中提取数据以动态生成选项。自定义标签在实际应用中具有很好的实用性。

发表于:2012年计算机科学与信息处理国际会议(CSIP)

会议日期:2012年8月24日至26日

第一部分

序言

下拉菜单通常用于选择项目。如果设计者想要在设计网页时限制用户输入内容,他经常使用下拉菜单来限制用户的可选项,而不是让用户根据自己的意愿随意输入。使用下拉菜单的优点是统一输入数据的格式,方便编程; 限制输入数据的范围等。

但是,下拉菜单的选项是固定的,而在某些软件应用程序中,经常会遇到一个问题:如果需要删除实际应用程序或在下拉菜单中添加选项,该如何处理? 我们可以使用下拉菜单的动态选项来添加功能吗?

JSP是主流的动态网页设计语言之一,而且目前他是动态网页的设计标准。 JSP标签是一组类似于HTML标签的网页标签。 通过使用JSP标签,我们可以轻松地在网页中实现我们需要的一些功能。 但是,除了JSP通用标签库之外,我们还可以编写自定义标签来实现用户个性化需求。

第二部分

JSP自定义标签的技术分析

  1. JSP标签的功能和结构

JSP实际上是HTML和JAVA技术的结合。 视图层和业务层之间的分离在项目程序设计中非常重要。 因此,在网页中不显示Java程序代码是非常必要的。 但是面对日益复杂的需求,视图层需要完成一些复杂的功能,所以便需要一种新的技术来实现,然后JSP标签就诞生了。

通过使用标签库,我们可以轻松实现一个无脚本的设计环境。 该标签将Java代码伪装成XML或HTML标签,从而替换Java脚本。

例如,我们可以使用。“if,elseif,else”标签在JSP页面中轻松实现Java选项代码。

通过上面的代码,我们可以在网页上实现一个根据学校名称来显示不同内容的功能。

B. JSP自定义标签

随着现代软件需求的不断提高,JSP标准标签库已经无法满足软件开发的需求。自定义标签这时就需要扩大自身库来实现各种个性化需求。

通过使用自定义标签技术,我们可以无限制地增加JSP功能,我们可以统一制作项目的网页,并且可以提高代码的复用性。

自定义标签设计包含以下部分:

  • JavaBean,它是标签库程序代码的基础部分
  • 标签库配置文件(TLD):TId是“taglib defination”的缩写,它也是标签的定义。该文件定义了标签的使用:如何加载标签的Java代码以及标签如何工作。;

除此之外,必须在“web.xml”文件中配置标签。

第三部分

动态下拉菜单实现

我在“Head Teacher System”项目中完成了一个名为dropDownMenu的自定义标签。 它的功能是根据数据库表动态生成下拉菜单选项。 下拉菜单的选项来自一个数据库表。 当表的数据发生变化时,我们不需要修改每个页面上的下拉菜单,因为下拉菜单会自行修改。

C.实现downDropMenu标签Java代码

以下是实现DownDropMenu标签的java代码部分:

D. downDropMenu标签的配置

要使自定义标签库可以重复使用,我们需要配置TLD文件和web.xml文件。

配置TLD文件

Tag TLD是taglib defination的缩写,也是标签库的定义。 此文件定义了标签的使用,以及如何加载Java代码以及标签如何工作。 在这个系统中,TLD称为ddm.tld,这是它的代码:

在JSP中,该属性被解释为Java类的变量,该值可以隐式访问。 它可以直接使用,也就是说,如果标签被指定为tableName = studenet,则DownDropMenuTag将自动从student表中获取值,并且可以直接使用该值。 这意味着您可以任意将属性增加到标签。DDM。 tld需要放在WEB-INF目录中,以确保可以访问已编译的DownDropMenuTag类到JSP容器。

E. downlDropmenu标签的应用

我们必须在JSP页面的开头添加以下预编译指令:

lt;taglib prefix =“ddm”URI =/ WEB -INF / ddm.tld“%gt;

根据该指令,编译器将在web.xml中找到以“ddm”开头的所有标签。然后我们需要在所需位置添加我们需要的标签。标签实例化后,doStartTag进程将自动执行。下拉菜单的选项将显示表格内的信息。

在“Head Teacher System”项目中,由于自定义标签的存在,下拉菜单是动态生成的,代码如下:

lt;ddm:downDropMenu tableblame =t_ worktypecolld =twt_idcolName =twt_name/gt;

然后,根据实现的相应参数自动返回相应的标签程序,然后找到系统数据库中的工作类型表,并从表中下载相应的字段名称,以显示在下拉菜单中。效果如图所示。

第四部分

结论

有了自定义标签的帮助,可以轻松实现个性化应用程序。 上面的程序实现了一个自动生成的下拉菜单。下拉菜单可以轻松将来自数据库表的内容转换成自己需要的格式。 当数据库表发生变化时,下拉选项也随之更改,方便网页设计。

剩余内容已隐藏,支付完成后下载完整资料


资料编号:[19905],资料为PDF文档或Word文档,PDF文档可免费转换为Word

原文和译文剩余内容已隐藏,您需要先支付 30元 才能查看原文和译文全部内容!立即支付

以上是毕业论文外文翻译,课题毕业论文、任务书、文献综述、开题报告、程序设计、图纸设计等资料可联系客服协助查找。