亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

好想沒有這個標簽啊


package com.ls.action;


import com.ls.entity.User;

import com.opensymphony.xwork2.ActionSupport;

import com.opensymphony.xwork2.ModelDriven;


public class LoginAction extends ActionSupport implements ModelDriven<User>{


private static final long serialVersionUID = 2420947456421303802L;

private User user =new User();

public String login() {

if(user.getUsername()==null || " ".equals(user.getUsername())){

this.addFieldError("username", "姓名不能為空");

return INPUT;

}

System.out.println(user.getUsername());

System.out.println(user.getBookList().get(0).getUsername());

System.out.println(user.getBookList().get(1).getUsername());

return SUCCESS;

}


@Override

public User getModel() {

// TODO Auto-generated method stub

return user;

}




}


正在回答

3 回答

http://img1.sycdn.imooc.com//59cd2eae0001c0c819200944.jpg莫名哦

0 回復 有任何疑惑可以回復我~

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">

<struts>

<package name="default" namespace="/" ?extends="struts-default">?

<action name="LoginAction" ?class="com.ls.action.LoginAction" ?method="login">

<result >/success.jsp</result>

<result name="input">/index.jsp</result>

</action>

</package>

</struts> ? ?


0 回復 有任何疑惑可以回復我~

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%@taglib prefix="s" uri="/struts-tags" %>

<%

String path = request.getContextPath();

String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

? <head>

? ? <base href="<%=basePath%>">

? ??

? ? <title>My JSP 'index.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">

<meta http-equiv="cache-control" content="no-cache">

<meta http-equiv="expires" content="0"> ? ?

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">

<meta http-equiv="description" content="This is my page">

<!--

<link rel="stylesheet" type="text/css" href="styles.css">

-->

? </head>

??

? <body>

? ? <form action="LoginAction.action" method="post" >

? ? <input type="text" name="username"/><s:fielderror name="username"></s:fielderror><br/>

? ? <input type="text" name="password"/><br/>

? ? <input type="text" name="bookList[0].username"/><br/>

? ? <input type="text" name="bookList[1].username"/><br/>

? ? <input type="text" name="age"/><br>

? ? <input type="submit" value="提交"/><br/>

? ? </form>

? </body>

</html>


0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

好想沒有這個標簽啊

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號