用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字

feng    -  云代码空间

——

J2EE+struts2+hibernate 服装管理系统

2013-07-06|4116阅||

摘要:货号管理模块: GoodsSC.hbm.xml: <hibernate-mapping>     <class name="com.csms.po.GoodsSC" table="goods_sc">              <i

货号管理模块:

GoodsSC.hbm.xml:

<hibernate-mapping>

    <class name="com.csms.po.GoodsSC" table="goods_sc">      

       <id name="id" column="id" type="java.lang.Integer">

            <generator class="native"></generator>

       </id>

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

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

       <many-to-one name="goodspo" class="com.csms.po.GoodsPO" column="goodsno" fetch = "join" lazy="false" cascade="save-update">

       </many-to-one>

    </class>

</hibernate-mapping>

 

*GoodsSC.java、GoodsPO.java、GoodsPO.hbm.xml:略

 

GoodsDAO.java:

package com.csms.dao;

//*import略

 

public class GoodsDAO{

   

    private HibernateService sf = new HibernateService();

    private List<GoodsSC> list; 

   

    public boolean save(GoodsSC goodsSc){     //保存到货号明细表

       try{

           Transaction tx=null;

           Session session=HibernateService.getSession();

           tx = session.beginTransaction();       

           session.save(goodsSc);

           tx.commit();  

       }

       catch(Exception e){

           e.printStackTrace();

           return false;

       }

       finally

       {

           HibernateService.closeSession();

       }

       return true;

    }

    public boolean save(GoodsPO goodspo){      //保存到货号表

       try{

           Transaction tx=null;

           Session session=HibernateService.getSession();

           tx = session.beginTransaction();       

           session.save(goodspo);

           tx.commit();  

       }

       catch(Exception e){

           e.printStackTrace();

           return false;

       }

       finally

       {

           HibernateService.closeSession();

       }

       return true;

    }

 

    public void delete(int id){        //从货号明细表删除

       try{

           Session session=HibernateService.getSession();

           Transaction tx = session.beginTransaction();

           Query q=session.createQuery("delete from GoodsSC where id=? ");

           q.setInteger(0, id);

           q.executeUpdate();

           tx.commit();

       }

       catch(Exception e){

           e.printStackTrace();

       }

       finally

       {

           HibernateService.closeSession();

       }

    }

 

    public void delete(String gn){        //从货号表删除

       try{

           Session session=HibernateService.getSession();

           Transaction tx = session.beginTransaction();

           Query q=session.createQuery("delete from GoodsPO where goodsno=? ");

           q.setString(0, gn);

           q.executeUpdate();

           tx.commit();

       }

       catch(Exception e){

           e.printStackTrace();

       }

       finally

       {

           HibernateService.closeSession();

       }

    }

 

    public void update(GoodsSC goods){          //级联更新

       try{

           Transaction tx = null;

           Session session=HibernateService.getSession();

           tx = session.beginTransaction();

           session.update(goods);

           tx.commit();

       }

       catch(Exception e){

           e.printStackTrace();

       }

       finally

       {

           HibernateService.closeSession();

       }

    }

 

    public List<GoodsSC> query(){       //查询全部货号明细

       Transaction tx=null;

       try{

           Session session=HibernateService.getSession();

           tx=session.beginTransaction();

           list= new ArrayList<GoodsSC>();        

           list=(List<GoodsSC>)session.createQuery("from GoodsSC").list();              tx.commit();

       }

       catch(Exception e){

           e.printStackTrace();

       }

        finally

       {

           HibernateService.closeSession();

       }

       return list;

    }

 

    public GoodsSC queryByid(int id){         //按id查询货号明细表

       Transaction tx=null;

       GoodsSC gc= new GoodsSC();

       try{

           Session session=HibernateService.getSession();

           tx=session.beginTransaction();

           list=new ArrayList<GoodsSC>();

           list=(List<GoodsSC>)session.createQuery("from GoodsSC where id=?").setParameter(0, id).list();

           if(!list.isEmpty()){

               gc=list.get(0);

               return gc;

           }

           tx.commit();

       }

       catch(Exception e){

           e.printStackTrace();

       }

        finally

       {

           HibernateService.closeSession();

       }

       return null;

    }

 

    public GoodsPO queryBygoodsno(String gn){      //按货号查询货号表

       Transaction tx=null;

       GoodsPO gp= new GoodsPO();

       try{

           Session session=HibernateService.getSession();

           tx=session.beginTransaction();

           List<GoodsPO> list=new ArrayList<GoodsPO>();

           list=(List<GoodsPO>)session.createQuery("from GoodsPO where goodsno=?").setParameter(0, gn).list();

           if(!list.isEmpty()){

               gp=list.get(0);

               return gp;

           }

           tx.commit();

       }

       catch(Exception e){

           e.printStackTrace();

       }

        finally

       {

           HibernateService.closeSession();

       }

       return null;

    }  

 

   public List<GoodsSC> query(GoodsSC gc){       //模糊条件查询+级联查询

       list=new ArrayList<GoodsSC>();

       Transaction t = null;

       try{          

           Session session=HibernateService.getSession();

           t=session.beginTransaction();

           Criteria cta = session.createCriteria(GoodsSC.class);     list=cta.add(Example.create(gc).excludeZeroes().ignoreCase().enableLike(MatchMode.ANYWHERE)).createCriteria("goodspo").add(Example.create(gc.getGoodspo()).excludeZeroes().ignoreCase().enableLike(MatchMode.ANYWHERE)).list();

           t.commit();

       }

       catch(Exception e){

           e.printStackTrace();

       }

       finally

       {

           HibernateService.closeSession();

       }

       return list;

    }  

 

    public List<GoodsSC> query(String goodsno){      //按货号查询货号明细表

       Transaction tx=null;

       GoodsSC gc= new GoodsSC();

       try{

           Session session=HibernateService.getSession();

           tx=session.beginTransaction();

           list=new ArrayList<GoodsSC>();

           list=(List<GoodsSC>)session.createQuery("from GoodsSC where goodsno=?").setParameter(0, goodsno).list();

           tx.commit();

       }

       catch(Exception e){

           e.printStackTrace();

       }

        finally

       {

           HibernateService.closeSession();

       }

       return list;

    }

}

 

 

GoodsService.java:

public class GoodsService{

    private GoodsDAO dao;

 

    public boolean addGoods(GoodsVO gv){       //新增

       dao=new GoodsDAO();

       GoodsSC gc=new GoodsSC();

       GoodsPO gp=new GoodsPO();

       if(dao.queryBygoodsno(gv.getGoodsno())!=null){

           //如果已存在此货号,则只新增货号明细

           gp=dao.queryBygoodsno(gv.getGoodsno());    

           if(!gp.getName().equals(gv.getName())){

               return false;

           }         

       }

       else{

           gp.setGoodsno(gv.getGoodsno());

           gp.setName(gv.getName());

           gp.setInside(gv.getInside());

           gp.setLining(gv.getLining());

           gp.setFactoryprice(gv.getFactoryprice());

           gp.setRetailprice(gv.getRetailprice());

           if(!dao.save(gp)){return false;}      //保存到货号表

       }

       gc.setColor(gv.getColor());

       gc.setSize(gv.getSize());

       gc.setId(gv.getId());

       gc.setGoodspo(gp);

       if(!dao.save(gc)){return false;}        //保存到货号明细表

       return true;

    }

 

    public boolean delGoods(int id){       //删除

       dao=new GoodsDAO();

       GoodsSC gc=new GoodsSC();

       GoodsPO gp=new GoodsPO();

       String gn=new String();

       if(dao.queryByid(id)!=null){

           gn=dao.queryByid(id).getGoodspo().getGoodsno();

           dao.delete(id);

           gp.setGoodsno(gn);

           gc.setGoodspo(gp);

           if(dao.query(gc).isEmpty()){

           //如果这个货号的所有明细记录被删除,则删除这个货号

               dao.delete(gn);

           }

           return true;

       }

       else{

           return false;

       }

    }

 

    public boolean updGoods(GoodsVO gv){          //更新

       dao=new GoodsDAO();

       GoodsPO gp=new GoodsPO();

       GoodsSC gc=new GoodsSC();

       gp.setGoodsno(gv.getGoodsno());

       gp.setFactoryprice(gv.getFactoryprice());

       gp.setInside(gv.getInside());

       gp.setLining(gv.getLining());

       gp.setName(gv.getName());

       gp.setRetailprice(gv.getRetailprice());

       gc.setGoodspo(gp);

       gc.setColor(gv.getColor());

       gc.setSize(gv.getSize());

       gc.setId(gv.getId());

       if(dao.queryByid(gv.getId())!=null){

           dao.update(gc);

           return true;

       }

       else{

           return false;

       }

    }

 

    public List<GoodsSC> queGoods(){    //查询所有货号和明细

       dao=new GoodsDAO();

       return dao.query();  

    }

 

    public GoodsSC queGoodsById(int id){    //按id查询货号明细

       dao=new GoodsDAO();

       return dao.queryByid(id);

    }

 

    public GoodsPO queGoodsBygoodsno(String gn){       //按货号查询货号

       dao=new GoodsDAO();

       return dao.queryBygoodsno(gn);  

    }

 

    public List<GoodsSC> queGoods(GoodsVO gv){       //按条件查询货号明细

       dao=new GoodsDAO();

       GoodsPO gp=new GoodsPO();

       GoodsSC gc=new GoodsSC();

       gp.setGoodsno(gv.getGoodsno());

       gp.setName(gv.getName());

       gc.setColor(gv.getColor());     

       gc.setSize(gv.getSize());

       gc.setGoodspo(gp);

       return dao.query(gc);   

    }

 

    public List<GoodsSC> query(String goodsno){    //按货号查询货号明细

       dao=new GoodsDAO();

       return dao.query(goodsno);

    }

}

 

 

addGoods.java:

public class addGoods extends ActionSupport{

    private GoodsVO goodsvo=new GoodsVO();

    private GoodsPO gp;

    private GoodsSC gc;

    @Override

    public String execute() throws Exception {       //新增货号和明细

       GoodsService gs=new GoodsService();

       if(!gs.addGoods(goodsvo)){             

           this.addActionError("add error");

       }

       this.addActionMessage("新增");

       return SUCCESS;

    }

 

    public String query() throws Exception {        //根据货号显示出相关信息

       GoodsService gs=new GoodsService();

       gp=new GoodsPO();

       gc=new GoodsSC();

       if(!goodsvo.getGoodsno().isEmpty()){

           if(gs.queGoodsBygoodsno(goodsvo.getGoodsno())!=null){

               setGp(gs.queGoodsBygoodsno(goodsvo.getGoodsno()));

               gc.setGoodspo(gp);

           }

           else{

               gp.setGoodsno(goodsvo.getGoodsno());          

               gc.setGoodspo(gp);

           }

       }

       return INPUT;

    }

 

    //*省略set、get

}

 

 

delGoods.java:

public class delGoods extends ActionSupport{

    private int id;

   

    @Override

    public String execute() throws Exception {      //删除货号明细

       GoodsService gs=new GoodsService();

       gs.delGoods(id);

       return SUCCESS;

    }

}

 

 

 queGoods.java:

public class queGoods extends ActionSupport{

    private GoodsService gs;

    private String goodsno;

    private String name;

    private String color;

    private String size;

    private List<GoodsSC> goods;

    private GoodsVO goodsvo;

    private int id;

    private GoodsSC gc;  

    @Override

    public String execute() throws Exception {      //查询货号明细

       gs=new GoodsService();

       setGoods(new ArrayList<GoodsSC>());

       if(goodsno==null && name==null && color==null && size==null){   

           setGoods((List<GoodsSC>)gs.queGoods());

       }

       else{

           goodsvo=new GoodsVO();

           goodsvo.setGoodsno(goodsno);

           goodsvo.setColor(color);

           goodsvo.setName(name);

           goodsvo.setSize(size);

           goods=(List<GoodsSC>)gs.queGoods(goodsvo);

       }     

       return SUCCESS;

    }

    public String query() throws Exception {        //按id查询货号明细

       gs=new GoodsService();

       gc=new GoodsSC();

       gc=gs.queGoodsById(id);     

       return "detail";

    }

}

 

updGoods.java:

public class updGoods extends ActionSupport{

    private GoodsVO goodsvo=new GoodsVO(); 

    @Override

    public String execute() throws Exception {       //更新货号和明细

       GoodsService gs=new GoodsService();    

       if(!gs.updGoods(goodsvo)){

           this.addActionError("update errors");

       }

       this.addActionMessage("修改");

       return SUCCESS;

    }

}

struts.xml:
<package name="Goods" extends="struts-default" namespace="/goods">
        <action name="queaction" class="com.csms.action.goods.queGoods">
           <result>/system/CLOTHING1001.jsp</result>
           <result name="error">/error.jsp</result>
           <result name="detail">/system/CLOTHING1002.jsp</result> 
           <result name="input">/system/CLOTHING1001.jsp</result>    
        </action>
        <action name="addaction" class="com.csms.action.goods.addGoods">
        <result>/system/savegoods.jsp</result>
        <result name="error">/error.jsp</result>
        <result name="input">/system/CLOTHING1002.jsp</result>        
        </action>
        <action name="updaction" class="com.csms.action.goods.updGoods">
        <result>/system/savegoods.jsp</result>
        <result name="error">/error.jsp</result>
        <result name="input">/system/CLOTHING1002.jsp</result>        
        </action>
        <action name="delaction" class="com.csms.action.goods.delGoods">
        <result>/system/delegoods.jsp</result>
        <result name="error">/error.jsp</result>
        <result name="input">/system/CLOTHING1001.jsp</result>        
        </action>
    </package>

CLOTHING1001.jsp:
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%@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>
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=gb2312">
<META HTTP-EQUIV="content-script-type" CONTENT="text/JavaScript">
<META HTTP-EQUIV="content-style-type" CONTENT="text/css">
<title>日志查询</title>
<link rel="stylesheet" href="../css/cjpm.css">
<script type="text/javascript" src="../js/cjcalendar.js"></script>
<script language="javascript" src="../js/page.js"></script>
</head>
<script language="javascript">
var CalendarWebControl = new atCalendarControl();
</script>
<SCRIPT LANGUAGE="javaScript">
function del(id){
if(confirm("您确定删除该条记录?")){
document.forms['goodsMain'].action="<%=path%>/goods/delaction.action?id="+id;
document.forms['goodsMain'].submit();
}
}
</SCRIPT>
<BODY BACKGROUND="../image/bg.gif">
<s:form action="queaction" name="goodsMain" method="POST" id="idmig0101"  namespace="/goods">


<table border=0 cellspacing=0 cellpadding=2 width="100%" bgcolor="gray">
<tr>
<td class="headerbar61">货号查询</td>
    <td class="headerbar63" width="50%" colspan="1"><p align="right">
    <input type=submit value=" 查 询 "></p></td>
</tr>
</table>


<table border=0 cellspacing=0 cellpadding=2 width="100%" height="5">
<tr>
<td></td>
</tr>
</table>


<table border=0 cellspacing=1 cellpadding=2 width="100%" bgcolor="gray">
<tr>


    <td class="textbar81" width="15%">货号</td>
<td class="textbar01" width="35%">
<input type="text" name="goodsno" style="width:210px ">  </td>    
<td class="textbar81" width="15%">品名</td>
<td class="textbar01" width="35%">
<input type="text" name="name" style="width:210px ">  </td>    
</tr>   
   <tr> 
            <td width="15%" class="textbar81">色号</td> 
            <td class="textbar01" width="35%"> <select name="color" style="width:210px "> 
               <option value="" selected="selected">请选择</option> 
                <option value="大红色">大红色</option> 
                <option value="浅红色">浅红色</option> 
                <option value="紫红色">紫红色</option> 
<option value="纯白色">纯白色</option> 
                <option value="米白色">米白色</option> 
<option value="深蓝色">深蓝色</option> 
                <option value="淡蓝色">淡蓝色</option> 
<option value="黑色">黑色</option> 
                <option value="棕色">棕色</option>
                <option value="黄色">黄色</option> 
                <option value="红色">红色</option>
                <option value="绿色">绿色</option>
                <option value="天蓝色">天蓝色</option> 
                <option value="金色">金色</option>
                <option value="粉红色">粉红色</option>   
                <option value="青色">青色</option>
                <option value="蓝色">蓝色</option> 
                <option value="橙色">橙色</option>  
                <option value="银色">银色</option>
                <option value="灰色">灰色</option>
                <option value="紫色">紫色</option>
              </select></td> 
         
            <td width="15%" class="textbar81">尺码</td> 
            <td class="textbar01" width="35%"> <select name="size" style="width:210px "> 
               <option value="" selected="selected">请选择</option> 
                <option value="150">150</option> 
                <option value="155">155</option> 
                <option value="160">160</option> 
<option value="165">165</option> 
                <option value="170">170</option> 
<option value="175">175</option> 
                <option value="180">180</option> 
<option value="185">185</option> 
                <option value="190">190</option> 
              </select> </td>            
          </tr>  
</table>
<table border=0 cellspacing=0 cellpadding=0 width="100%" height=5>
<tr>
<td></td>
</tr>
</table>


<table border="0" width="100%" id="table1" cellspacing="0"  cellpadding="2"  bgcolor="gray">
<tr>
  <td class="headerbar61" width="50%" colspan="1">货号明细</td>
    <td class="headerbar63" width="50%" colspan="1"><p align="right">
    <input type=button value=" 新 增 " onclick="location='<%=path%>/system/CLOTHING1002.jsp'" /></p></td>
  </tr>
</table>
  <table border=0 cellspacing=0 cellpadding=2 width="100%" height="5"> 
    <tr> 
      <td></td> 
    </tr> 
  </table> 
<table border="0" width="100%" id="table1" cellspacing="0"  cellpadding="0"  bgcolor="gray">
<tr>
  <td  width="100%" colspan="1">
  <table  border="0" cellspacing="1" cellpadding="2" width="100%">
  <tr>
<td  width="5%" class="headerbar82">序号</td>
<td  width="10%" class="headerbar82">货号</td>
<td  width="10%" class="headerbar82">色号</td>
<td  width="10%" class="headerbar82">尺码</td>
<td  width="15%" class="headerbar82">品名</td>
                    <td  width="10%" class="headerbar82">出厂价</td>
<td  width="10%" class="headerbar82">零售价</td>
<td   class="headerbar82">操作</td>
</tr>
<%int i; i=1; %>
<s:iterator value="goods" id="goods" status="st">
<s:iterator value="#goods.goodspo" id="goodspo">
<tr>
<td class="gridbar11" align="center"><%=i++%></td>
<td class="gridbar11" align="center"><a href="<s:url action="queaction?id=%{#goods.id}" method="query"></s:url>"><s:property value="#goodspo.goodsno"></s:property></a></td>
<td class="gridbar11" align="center"><s:property value="#goods.color"></s:property></td>
<td class="gridbar11" align="center"><s:property value="#goods.size"></s:property></td>
<td class="gridbar11" align="center"><s:property value="#goodspo.name"></s:property></td>
<td class="gridbar11" align="center"><s:property value="#goodspo.factoryprice"></s:property></td>
<td class="gridbar11" align="center"><s:property value="#goodspo.retailprice"></s:property></td>
<td class="gridbar11" align="center"><img src="../image/del.gif" align="bottom" border="0" alt="删除" onClick="del('<s:property value="#goods.id"/>')" style="cursor:hand"/></td>
</tr>
</s:iterator>
</s:iterator>
</table>
</td>
</tr>
</table>


<table width="100%" border="0" cellpadding="1" cellspacing="2" >
        <tr>
          <td colspan="2" align="right" height="20"  nowrap class="textbar3" >
&nbsp; 共4条 &nbsp; 第1/1页 &nbsp;       <a  href="#" style="cursor:hand">首页</a>&nbsp; 
      <a   style="cursor:hand" href="#">上一页</a>&nbsp;
      <a  style="cursor:hand" href="#">下一页</a>&nbsp; 
      <a   style="cursor:hand" href="#">尾页</a>&nbsp; 
&nbsp;
</td>
          </tr>
        </table>

</s:form>
</BODY>
</html>

CLOTHING1002:
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%@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>
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=gb2312">
<META HTTP-EQUIV="content-script-type" CONTENT="text/JavaScript">
<META HTTP-EQUIV="content-style-type" CONTENT="text/css">
<title>品牌修改</title>
<link rel="stylesheet" href="../css/cjpm.css">
<script type="text/javascript" src="../js/cjcalendar.js"></script>
<script language="javascript" src="../js/page.js"></script>
</head>
<script language="javascript">
var CalendarWebControl = new atCalendarControl();
</script>
<SCRIPT LANGUAGE="javaScript">
function show(color,size){
var obj=document.getElementsByName("goodsvo.color")[0];
var val;
for(var index=0;index<obj.length;index++){
val=obj.options[index].value;
if(color==val){
obj.options[index].selected=true;
}
}
obj=document.getElementById("s2");
for(var index=0;index<obj.length;index++){
val=obj.options[index].value;
if(size==val){
obj.options[index].selected=true;
}
}
}
function query(){
var val=document.getElementById("t1").value;
if('${id}'==0){
window.location.href="<%=path%>/goods/addaction!query.action?goodsvo.goodsno="+val;
}
}
function putin(id){
if(id==0){
document.forms['goodsdetail'].action="<%=path%>/goods/addaction.action";
}else{
document.forms['goodsdetail'].action="<%=path%>/goods/updaction.action?goodsvo.id=${id}";
}
document.forms['goodsdetail'].submit();
}
function back(){
if('${id}'==0&&document.getElementById("t2").value!=""){
if(confirm("您确定不保存记录吗?")){
location.href="<%=path%>/goods/queaction.action";
}
}else{
location.href="<%=path%>/goods/queaction.action";
}
}
</SCRIPT>
<BODY BACKGROUND="../image/bg.gif" onload="show('<s:property value="gc.color"/>','<s:property value="gc.size"/>')"> 
<s:form name="goodsdetail" method="POST"> 
  <table border="0" width="100%"> 
    <tr> 
      <td width="100%" colspan="0" rowspan="0" align="center" valign="center"> <table border="0" width="100%" id="table1" cellspacing="0"  cellpadding="2"  bgcolor="gray"> 
          <tr> 
            <td class="headerbar61" width="50%">货号详细</td> 
            <td class="headerbar63" width="50%"> <input type="button" name="save70302002" value=" 保 存 " onclick="putin('<s:property value="id"/>')"> 
              <input type="button" name="save70302002" onClick="back()" value=" 返 回 "> 
&nbsp; </td> 
          </tr> 
        </table></td> 
    </tr> 
    <tr> 
      <td width="100%" colspan="0" rowspan="0" align="center" valign="center"> <table border="0" width="100%" id="table1" cellspacing="1"  cellpadding="2"  bgcolor="gray"> 
          <tr> 
           <td class="textbar81" width="15%">货号</td> 
            <td class="textbar01" width="35%"> <input type="text" name="goodsvo.goodsno" id="t1" value="<s:property value="gc.goodspo.goodsno"/>" size="15" style="width:210px " onblur="query()"> </td>  
<td class="textbar81" width="15%">品名</td> 
            <td class="textbar01" width="35%"> <input type="text" name="goodsvo.name" id="t2" value="<s:property value="gc.goodspo.name"/>" size="15" style="width:210px "> </td> 
          </tr> 
          <tr> 
            <td width="15%" class="textbar81">色号</td> 
            <td class="textbar01" width="35%"> <select name="goodsvo.color" id="s1" style="width:210px "> 
               <option value="" selected="selected">请选择</option> 
                <option value="大红色">大红色</option> 
                <option value="浅红色">浅红色</option> 
                <option value="紫红色">紫红色</option> 
<option value="纯白色">纯白色</option> 
                <option value="米白色">米白色</option> 
<option value="深蓝色">深蓝色</option> 
                <option value="淡蓝色">淡蓝色</option> 
<option value="黑色">黑色</option> 
                <option value="棕色">棕色</option> 
                <option value="黄色">黄色</option> 
                <option value="红色">红色</option>
                <option value="绿色">绿色</option>  
                <option value="天蓝色">天蓝色</option> 
                <option value="金色">金色</option>
                <option value="粉红色">粉红色</option>   
                <option value="青色">青色</option>
                <option value="蓝色">蓝色</option> 
                <option value="橙色">橙色</option>
                <option value="银色">银色</option>
                <option value="灰色">灰色</option> 
                <option value="紫色">紫色</option>
              </select></td> 
         
            <td width="15%" class="textbar81">尺码</td> 
            <td class="textbar01" width="35%"> <select name="goodsvo.size" id="s2" style="width:210px "> 
               <option value="" selected="selected">请选择</option> 
                <option value="150">150</option> 
                <option value="155">155</option> 
                <option value="160">160</option> 
<option value="165">165</option> 
                <option value="170">170</option> 
<option value="175">175</option> 
                <option value="180">180</option> 
<option value="185">185</option> 
                <option value="190">190</option> 
              </select> </td>            
          </tr> 
  <tr> 
            <td width="15%" class="textbar81">面料</td> 
            <td class="textbar01" width="35%"> <input type="text" name="goodsvo.lining" value="<s:property value="gc.goodspo.lining"/>" size="15" style="width:210px "> </td> 
            <td class="textbar81" width="15%">里料</td> 
            <td class="textbar01" width="35%"> <input type="text" name="goodsvo.inside" value="<s:property value="gc.goodspo.inside"/>" size="15" style="width:210px "> </td> 
          </tr> 
          <tr> 
            <td width="15%" class="textbar81">出厂价</td> 
            <td class="textbar01" width="35%"> <input type="text" name="goodsvo.factoryprice" value="<s:property value="gc.goodspo.factoryprice"/>" size="15" style="width:210px "> </td> 
            <td class="textbar81" width="15%">零售价</td> 
            <td class="textbar01" width="35%"> <input type="text" name="goodsvo.retailprice" value="<s:property value="gc.goodspo.retailprice"/>" size="15" style="width:210px "> </td> 
          </tr>  
        </table> 
        <table border=0 cellspacing=0 cellpadding=0 width="100%" height=5> 
          <tr> 
            <td></td> 
          </tr> 
        </table></td> 
    </tr> 
  </table> 
</s:form>
</BODY>
</html>

saveGoods:
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%@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>提交</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>
  <SCRIPT LANGUAGE="javaScript">
  function hints(){
  alert('${actionMessages[0]}'+"成功!");
  if('${actionMessages[0]}'=="修改"){
  location.href="<%=path%>/goods/queaction!query.action?id=${goodsvo.id}";  
  }
  else{
  location.href="<%=path%>/system/CLOTHING1002.jsp";
  }
  }
  function hintf(){
  alert('${actionMessages[0]}'+"失败!");
  if('${actionMessages[0]}'=="修改"){
  location.href="<%=path%>/goods/queaction!query.action?id=${goodsvo.id}";  
  }
  else{  
  setTimeout('hintfl()',5000);
  location.href="<%=path%>/system/CLOTHING1002.jsp";  
  }
  }
  </SCRIPT>
  <body>
  <s:if test="%{actionErrors.isEmpty()}"><script>hints();</script></s:if>
    <s:else><script>hintf();</script></s:else>
    <s:debug></s:debug>
  </body>
</html>


*其它模块:略
顶 14踩 13收藏
文章评论
共1 条评论 1/1页
发表评论

个人资料

  • 昵称: feng
  • 等级: 资深程序员
  • 积分: 1584
  • 代码: 8 个
  • 文章: 42 篇
  • 随想: 2 条
  • 访问: 85 次
  • 关注

站长推荐