鍍金池/ 問答/Java  網(wǎng)絡(luò)安全  HTML/ struts2使用標(biāo)簽庫報錯

struts2使用標(biāo)簽庫報錯

RegisterAction

package com.interceptors;

import com.opensymphony.xwork2.ActionSupport;

public class RegisterAction extends ActionSupport {
    private String username;
    
    public String getUserName() {
        return this.username;
    }
    
    public void setUserName(String username) {
        this.username = username;
    } 
    
    public String execute() {
        return SUCCESS;
    }
}

register.jsp

<%@ 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>Insert title here</title>
</head>
<body>
<form action="register.action" method="post">
    <input type="text" name="username" />
    <input type="submit" value="submit" />
</form>
<s:fielderror/>
</body>
</html>

加上一行s:fielderror就報錯 用s:form也報錯 JAR包如下 圖片描述

回答
編輯回答
傲寒

小伙子,學(xué)習(xí)springmvc吧

2017年8月25日 17:13