当前位置: 网站首页 > JAVA > j2ee

Struts 2 UI Tags Tutorial

时间:1970-1-1 08:33:31来源: j2ee作者:admin 点击:18次 字体 [ С]

Struts 2 UI Tags are simple and easy to use. You need not write any HTML code, the UI tags will automatically generate them for you based on the theme you select. By default the XHTML theme is used. The XHTML theme uses tables to position the form elements.

In this example you wil see how to create a registration page using Struts 2 UI tags. You will also learn how to pre populate the form fields, set default values to it and to retrive the values back in the jsp page.

The register.jsp looks like this

photo 1 
The following code is used to create the register.jsp page

01.<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
02.pageEncoding="ISO-8859-1"%>
03.<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
04.<%@taglib uri="/struts-tags" prefix="s"%>
05.<html>
06.<head>
07.<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

发表评论
验证码:
最新评论