1. 程式人生 > >jsp中使用struts標籤

jsp中使用struts標籤

在jsp頁面中使用struts標籤需要引用標籤庫<%@ taglib prefix="s" uri="/struts-tags" %>


使用方法:

<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>register</title>
</head>
<body>
<center>
<s:form action="reg">
<s:textfield name="name" label="Name"></s:textfield>
<s:radio label="Sex" name="sex" list="#{'male':'男','female':'女' }" listKey="key" listValue="value" />
<s:textfield name="age" label="Age"></s:textfield>
<s:textfield name="mail" label="E-Mail"></s:textfield>
<s:textfield name="tel" label="Tel"></s:textfield>
<s:submit ></s:submit>
</s:form>
</center>
</body>
</html>

效果: