浏览 1833 次
该帖已经被评为隐藏帖
|
|
---|---|
作者 | 正文 |
发表时间:2009-07-15
引用 <div class="pannelbody"> <div class="pannellist"> <form id="useradd" name="useradd" action="UserInseAction" method="post"> <label for="username">名称:</label> <input name="username" type="text" id="username" value="" size="30" class="colorblue" onFocus="this.className='colorfocus';" onBlur="this.className='colorblue';" /> <br /> <label for="nickname">昵称:</label> <input name="nickname" type="text" id="nickname" value="" size="30" class="colorblue" onFocus="this.className='colorfocus';" onBlur="this.className='colorblue';" /> <br /> <label for="password">密码:</label> <input name="password" type="password" id="password" value="" size="30" class="colorblue" onFocus="this.className='colorfocus';" onBlur="this.className='colorblue';" /> <br /> <label for="sex">性别:</label> <select name="sex" id="sex" class="colorblue"> <option value="0">女</option><option value="1">男</option><option value="9">人妖</option> </select> <br /> <label for="birthday">生日:</label> <input name="birthday" type="text" id="birthday" value="" size="30" class="colorblue Wdate" onFocus="this.className='colorfocus';WdatePicker({startDate:'1985-07-01'});" onBlur="this.className='colorblue';" /> <br /> <label for="remark">备注:</label> <textarea name="remark" cols="50" rows="6" id="remark" class="colorblue" onFocus="this.className='colorfocus';" onBlur="this.className='colorblue';" style="width:80%;"></textarea> <br /> <!---字段较多,省略一些个---> <label for=""></label> <input name="status" type="hidden" value="1" /> <input name="button" type="submit" class="sbutton" id="button" value="提交"/> <input name="button2" type="reset" class="sbutton" id="button2" value="返回" /> </form> </div> Struts.xml的配置 引用 <?xml version="1.0" encoding="gbk" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <package name="default" namespace="/" extends="struts-default"> <action name="*"> <result>/WEB-INF/jsp/{1}.jsp</result> </action> <action name="UserInseAction" class="com.lcsz.classmates.action.UserInfoAction"> <!-- result name="success" type="redirect">login</result--> <result name="success" type="redirect">login</result> <result name="input" type="redirect">UserIns</result> </action> </package> </struts> UserInfoAction.java 代码 引用 package com.lcsz.classmates.action; import com.lcsz.classmates.dao.UserDao; import com.lcsz.classmates.dao.impl.UserDaoImpl; import com.lcsz.classmates.pojo.User; import com.opensymphony.xwork2.ActionSupport; import com.opensymphony.xwork2.ModelDriven; public class UserInfoAction extends ActionSupport implements ModelDriven<User> { /** * long */ private static final long serialVersionUID = 1L; public User user = new User(); public String execute(){ UserDao userdao = new UserDaoImpl(); try { if (userdao.UserIns(user)) { return SUCCESS; } else { return INPUT; } } catch (Exception e) { System.out.println("发现错误:"+e.getMessage()); return INPUT ; } } public User getModel() { return user; } } 在数据库中的插入记录 中文的话就是null 英文和数字可以插入进行 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2009-07-15
很郁闷的,
由于刚学Struts2 很多问题不知道是在哪产生的。 Struts.properties 中的设置如下 struts.enable.DynamicMethodInvocation = true struts.devMode = true struts.configuration.xml.reload =true struts.i18n.encoding =GBK struts.locale =zh_CN |
|
返回顶楼 | |