ssh中怎么修改级联对象值

泪的告白篇 2015-02-28 09:34:40

public String save(){

if(id == null){

model.setCreatetime(new Date());
}

System.out.println(model);
employeeService.saveorupdate(model);
return SUCCESS;
}

jsp的页面代码

<s:select list="#request.departments"
listKey="id" listValue="departname" name="department.id" label="Department"></s:select>


<class name="com.czf.ssh.entities.Employee" table="ssh_employees" >

<id name="id" column="id" type="integer">
<generator class="native"></generator>
</id>
<property name="lastname" column="lastname" type="string"/>

<property name="email" column="email" type="string"></property>

<property name="birth" column="birth" type="date"></property>

<property name="createtime" column="createtime" type="date"></property>

<!-- 映射单向 n-1 的关联关系 -->
<many-to-one name="department" class="com.czf.ssh.entities.Department" column="dept_id" cascade="all"></many-to-one>
</class>

这张是ssh_employee的表

这张是ssh_departmente的表

现在我怎么从jsp页面传参给dept_id 让它更新
求方法 各位大神
...全文
97 回复 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

67,549

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧