实体类
package io.longview.iib.admin.entity;
public class Pet {
private int id;
private String name;
private int age;
private String sex;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
}
Module代码
package io.longview.iib.admin.module;
import org.nutz.ioc.annotation.InjectName;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import io.longview.iib.admin.entity.Pet;
@At("/adaptor")
@InjectName
@IocBean
public class AdaptorModule {
@At("/form")
public void form(@Param("..") Pet pet){
System.out.println("下面是pet的属性:");
//System.out.println("pet.getId():"+pet.getId());
System.out.println("pet.getName():"+pet.getName());
System.out.println("pet.getAge():"+pet.getAge());
System.out.println("pet.getSex():"+pet.getSex());
}
@At("/")
@Ok("jsp:jsp.admin.adaptorIndex")
public void index(){
}
}
页面代码
<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="t" tagdir="/WEB-INF/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<t:adminpage page="testvue" pageTitle="vueAjaxCRUD" pageDesc=".">
<jsp:attribute name="resources">
<link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/fancytree/skin-bootstrap/ui.fancytree.min.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/select2/select2.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/bootstrap-tagsinput/bootstrap-tagsinput.css">
<!-- <link rel="stylesheet" href="${pageContext.request.contextPath}/css/vueCRUD.css"> -->
<style type="text/css">
</style>
</jsp:attribute>
<jsp:attribute name="bottomScripts">
<script type="text/javascript">
</script>
</jsp:attribute>
<jsp:attribute name="bottomScripts">
<script type="text/javascript" src="${pageContext.request.contextPath}/plugins/fancytree/jquery.fancytree-all.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/plugins/handlebars/handlebars-v4.0.5.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/plugins/bootstrap-notify/bootstrap-notify.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/plugins/select2/select2.full.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/plugins/bootstrap-tagsinput/bootstrap-tagsinput.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/plugins/vue/vue.js"></script>
<script>
$(document).ready(function() {
});
</script>
</jsp:attribute>
<jsp:body>
<div class="row" id="app">
<div class="col-md-12">
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">box-header</h3>
</div>
<div class="box-body no-padding">
<!-- box body -->
<form id="from" action="${ctx }/adaptor/form" method="post">
<!-- 宠物id<input type="text" name="pet.id"/>
<br/>
-->
宠物名字<input type="text" name="pet.name"/>
<br/>
宠物岁数<input type="text" name="pet.age"/>
<br/>
宠物性别<input type="text" name="pet.sex"/>
<br/>
<button type="submit" class="btn btn-info">提交</button>
</form>
<!-- box body -->
</div>
</div>
</div>
</div>
</jsp:body>
</t:adminpage>