67,549
社区成员




<?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>
<constant name="struts.i18n.encoding" value="gbk" />
<constant name="struts.objectFactory" value="spring" />
<package name="default" namespace="/admin" extends="struts-default">
<action name="putInsert" class="purveryAction"
method="Insert">
<result name="success">yes.html</result>
<result name="error">no.jsp</result>
</action>
<action name="getAll" class="purveryAction" method="get">
<result name="success">yes.jsp</result>
<result name="error">no.jsp</result>
</action>
<action name="getOne" class="purveryAction" method="get">
<result name="success">yes.jsp</result>
<result name="error">no.jsp</result>
</action>
</package>
</struts>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation" value="classpath:hibernate.cfg.xml">
</property>
</bean>
<bean id="txManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="get*" propagation="REQUIRED" read-only="true" />
<tx:method name="find*" propagation="REQUIRED" read-only="true" />
<tx:method name="search*" propagation="REQUIRED" read-only="true" />
<tx:method name="query*" propagation="REQUIRED" read-only="true" />
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="submit*" propagation="REQUIRED" />
<tx:method name="save*" propagation="REQUIRED" />
<tx:method name="insert*" propagation="REQUIRED" />
<tx:method name="del*" propagation="REQUIRED" />
<tx:method name="remove*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="modify*" propagation="REQUIRED" />
<tx:method name="check*" propagation="REQUIRED" />
<tx:method name="do*" propagation="REQUIRED" />
<tx:method name="*" propagation="REQUIRED" read-only="true" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="serviceMethod" expression="execution(* org.benz.action.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="serviceMethod" />
</aop:config>
<bean id="purveryDao" class="org.benz.dao.impl.PurveyDaoImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="purveryBiz" class="org.benz.biz.impl.PurveryBizImpl">
<property name="purdao" ref="purveryDao"></property>
</bean>
<bean id="purveryAction" class="org.benz.action.Purveyactionfrom">
<property name="purveryBiz" ref="purveryBiz"></property>
</bean>
</beans>
public String Insert() {
//将页面填写的省,市,区,详细地址合并成送货地址
this.purvey.setProvinces(this.getCity()+","+this.getRegion());
String str=purveryBiz.insert(purvey);
if(str =="插入成功"){
return SUCCESS;
}else{
return ERROR;
}
}
public String update(){
String ret =purveryBiz.updateById(purvey);
if(ret =="修改成功"){
return SUCCESS;
}
return ERROR;
}
public String get(){
List<Purvey> list = purveryBiz.getAll();
if(list != null){
ActionContext ac = ActionContext.getContext();
ac.getSession().put("supplierList", list);
return SUCCESS;
}else{
return ERROR;
}
}
public String getByTrading(){
Purvey pu = this.purveryBiz.getByTrading(this.getTrading());
if(pu != null){
ActionContext ac = ActionContext.getContext();
ac.getSession().put("purvey", pu);
return SUCCESS;
}else
{
return INPUT;
}
}
}
<s:form action="putInsert" method="post">
<table>
<tr>
<td colspan="4" class="subtitle">
供货商信息
</td>
</tr>
<tbody>
<tr>
<th style="width: 15%;">
<span class="warning">*</span>供货商代码:
</th>
<td>
<input id="Text2" type="text" name="purvey.trading" class="inputText" />
</td>
<th style="width: 15%;">
<span class="warning">*</span>中文名称:
</th>
<td>
<input id="Text26" name="purvey.chname" type="text" class="inputText" />
</td>
</tr>
<tr>
<th style="width: 300px;">
<span class="warning">*</span>英文名称:
</th>
<td>
<input id="Text27" type="text" name="purvey.englishname" class="inputText" />
</td>
<th style="width: 300px;">
<span class="warning">*</span>网址:
</th>
<td>
<input id="Text30" type="text" name="purvey.work" class="inputText" />
</td>
</tr>
<tr>
<th style="width: 300px;">
<span class="warning">*</span>联系人:
</th>
<td>
<input id="c_magazineId" type="text" name="purvey.linkman" class="inputText" />
</td>
<th style="width: 300px;">
<span class="warning">*</span>联系电话:
</th>
<td>
<input id="Text28" type="text" name="purvey.phone" class="inputText" />
</td>
</tr>
<tr>
<th>
<span class="warning">*</span>省市:
</th>
<td>
国家 <input type="text" id="country" name="purvey.country">
省<input type="text" id="sheng" name="city">
市 <input type="text" id="shi" name="region">
</td>
<th>
<span class="warning">*</span>详细地址:
</th>
<td>
<input id="Text1" type="text" class="inputText" name="purvey.address"/>
</td>
</tr>
<tr>
<th>
<span class="warning">*</span>邮政编码:
</th>
<td>
<input id="Text3" type="text" name="purvey.mail" class="inputText" />
</td>
<th>
<span class="warning">*</span>企业简称:
</th>
<td>
<input id="Text4" type="text" name="purvey.projectname" class="inputText" />
</td>
</tr>
<tr>
<th>
<span class="warning">*</span>开户银行:
</th>
<td>
<input id="Text5" type="text" name="purvey.bank" class="inputText" />
</td>
<th>
<span class="warning">*</span>账号:
</th>
<td>
<input id="Text6" type="text" name="purvey.accounts" class="inputText" />
</td>
</tr>
<tr>
<th>
<span class="warning">*</span>收款单位:
</th>
<td>
<input id="Text7" type="text" name="purvey.gatheringunit" class="inputText" />
</td>
<th>
<span class="warning">*</span>付款条件:
</th>
<td>
<input id="Text8" type="text" name="purvey.payment" class="inputText" />
</td>
</tr>
<tr>
<th>
备注:
</th>
<td colspan="3">
<textarea rows="5" style="width: 100%;" name="purvey.remark"></textarea>
</td>
</tr>
</tbody>
<tr>
<td colspan="6" class="toolbar">
<input type="submit" class="inputButton" value="确定" />
<input type="button" class="inputButton" value="取消" onclick="" />
</td>
</tr>
</table>
</s:form>