二、CreateOrderItemAction代码如下:
/**
 * 
 */
package com.iwtxokhtd.action;import java.util.Date;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;import com.iwtxokhtd.dao.CreateOrderItemDao;
import com.iwtxokhtd.form.OrderItemBeanForm;/**
 * @author iwtxokhtd
 *
 */
public class CreateOrderItemAction extends Action{ //航班日程安排dao
private CreateOrderItemDao itemdao; @Override
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
// TODO Auto-generated method stub
//错误消息对象
ActionMessages errors=new ActionMessages();


//从模型中获取数据
String id=(String)((OrderItemBeanForm)form).getId();
String year=(String)((OrderItemBeanForm)form).getYear();
String month=(String)((OrderItemBeanForm)form).getMonth();
String day=(String)((OrderItemBeanForm)form).getDay();
  
//转换字符格式

  id=new String(id.getBytes("ISO-8859-1"),"gb2312");
  year=new String(year.getBytes("ISO-8859-1"),"gb2312");
      month=new String(month.getBytes("ISO-8859-1"),"gb2312");
      day=new String(day.getBytes("ISO-8859-1"),"gb2312");
  Long lid=new Long(Long.parseLong(id));
          Date date=new Date(Integer.parseInt(year),Integer.parseInt(month),Integer.parseInt(day));
           //若id,year,month,day为空,则报错
     if(id==null||year==null||month==null||day==null)
     {
     errors.add("fail_1",new ActionMessage("CreateOrderItemAction.c"));
     saveErrors(request,errors);
     return mapping.getInputForward();
     }


//保存新的航班日程安排
if(!itemdao.CreateOrderItem(lid, date))
{
errors.add("fail_2", new ActionMessage("CreateOrderItemAction.a"));
saveErrors(request,errors);

}
else
{
errors.add("succeed_1",new ActionMessage("CreateOrderItemAction.b"));
saveErrors(request,errors);
}

return mapping.findForward("createok");


}
public CreateOrderItemDao getItemdao() {
return itemdao;
} public void setItemdao(CreateOrderItemDao itemdao) {
this.itemdao = itemdao;
}
}

解决方案 »

  1.   

    三、对应的DAO代码如下:
    /**
     * 管理员安排航班日程操作
     */
    package com.iwtxokhtd.dao;import java.util.Date;import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    import org.springframework.orm.hibernate3.support.HibernateDaoSupport;import com.iwtxokhtd.orm.Flight;
    import com.iwtxokhtd.orm.OrderItem;/**
     * @author iwtxokhtd
     *
     */
    public class CreateOrderItemDao extends HibernateDaoSupport { //Log4j日志对象
    private static final Log log=LogFactory.getLog(CreateOrderItemDao.class);

    //初始化dao
    protected void initDao()
    {
    //这里我们为空实现
    }

    //判断航班日程安排是否成功
    public boolean CreateOrderItem(long flightid,Date date)
    {
    //Flight实体对象
    Flight flight=(Flight) this.getHibernateTemplate().load(Flight.class, flightid);

    //订单实体对象
    OrderItem item=new OrderItem();

    //保存订单设置
    item.setFlight(flight);
    item.setDate(date);

    //执行保存操作
    try {

    this.getHibernateTemplate().save(item);
    return true;//保存成功
    } catch (Exception e) {
    // TODO: handle exception
    //报告异常
    log.error(e.getMessage());
    return false;
    }
    }
    }
      

  2.   

    四、对应的CreateOrderItem.JSP如下:
    <%@ page language="java" import="java.util.List" pageEncoding="gb2312"%>
    <%@ page import="java.util.Iterator" %>
    <%@ page import="com.iwtxokhtd.orm.Flight" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %><%
      String tmp=(String)session.getAttribute("curr_admin");
      if(tmp==null)
      {
      
     %>
      <jsp:forward page="/index.jsp"></jsp:forward>
      <%
       }
       List allFlights=(List)session.getAttribute("items");
       Iterator it=(Iterator)allFlights.iterator();
       Flight flight=null;
       String id=null,str=null,year=null,month=null,day=null;
       int y=2008,m=4,d=14;
       %>
    <html>
      <head>
       <title><bean:message key="admin.manage.page"/></title>
      </head>
      
      <body>
       <html:form action="/createOrderItem.do">
       <table width="97%" height="495"  border="0">
        <tr>
        <td height="27" align="center">
        <table width="68%" height="38"  border="0">
          <tr>
            <td align="center" bgcolor="#0099FF"><bean:message key="admin.system"/></td>
          </tr>
        </table>
        </td>
      </tr>
      <tr>
        <td height="17" align="center"><hr></td>
      </tr>
      <tr>
      <td align="center"><font color="red"><html:errors/></font></td>
      </tr>
      <tr>
          <td height="280" align="center">
          <table width="66%" height="201"  border="0">
          <tr>
            <td width="33%" height="73" align="center"><bean:message key="select.flight"/></td>
             <td width="67%">
             <html:select property="id" multiple="false" size="1">
             <%
               while(it.hasNext())
               {
               flight=(Flight)it.next();
               id=flight.getId()+"";
               str=flight.getFlight_no();
              %>
              <html:option value="<%=id%>"><%=str%></html:option>
              <%
              }
               %>
             </html:select>
             </td>
          </tr>
          <tr>
              <td height="69" align="center"><bean:message key="asign.flight.date"/></td>
              <td align="center">
              <table width="95%"  border="0">
              <tr>
              <td height="34">
              <html:select property="year" multiple="false" size="1">
               <%
                 while(y<=2020)
                 {
                   year=""+y;
               %>
               <html:option value="<%=year%>"></html:option>
               <%
                 y++;
                 }
                %>
              </html:select>
              <bean:message key="year"/>
              </td>
              <td>
                <html:select property="month" multiple="false" size="1">
    <%
    while(m <= 12){
    month = ""+m;
    %>
    <html:option value="<%=month%>"></html:option>
    <%
    m ++;
    }
    %>
    </html:select>
    <bean:message key="month"/>
              </td>
              <td>
                 <html:select property="day" multiple="false" size="1">
    <%
    while(d <= 31){
    day = ""+d;
    %>
    <html:option value="<%=day%>"></html:option>
    <%
    d++;
    }
    %>
    </html:select>
    <bean:message key="day"/>
              </td>
              </tr>
              </table>
              </td>
          </tr>
          <tr>
            <td colspan="2" align="center">
            <table width="58%" height="37"  border="0" cellspacing="0">
              <tr align="center">
               <td><html:submit><bean:message key="queding"/></html:submit></td>
              </tr>
            </table>
            </td>
           </tr>
        </table>
        </td>
          </tr>
        </table>
          </td>
      </tr>  
       </table>
       </html:form>
      </body>
    </html>
      

  3.   

    五、对应的Bean如下:
    /*
     * Generated by MyEclipse Struts
     * Template path: templates/java/JavaClass.vtl
     */
    package com.iwtxokhtd.form;import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;/** 
     * MyEclipse Struts
     * Creation date: 04-14-2008
     * 
     * XDoclet definition:
     * @struts.form name="orderItemBeanForm"
     */
    public class OrderItemBeanForm extends ActionForm {
    /*
     * Generated fields
     */ /**
     * 
     */
    private static final long serialVersionUID = 1L; /** month property */
    private String month; /** day property */
    private String day; /** year property */
    private String year; /** id property */
    private String id; /*
     * Generated Methods
     */ /** 
     * Method validate
     * @param mapping
     * @param request
     * @return ActionErrors
     */
    public ActionErrors validate(ActionMapping mapping,
    HttpServletRequest request) {
    // TODO Auto-generated method stub
    return null;
    } /** 
     * Method reset
     * @param mapping
     * @param request
     */
    public void reset(ActionMapping mapping, HttpServletRequest request) {
    // TODO Auto-generated method stub
    } /** 
     * Returns the month.
     * @return String
     */
    public String getMonth() {
    return month;
    } /** 
     * Set the month.
     * @param month The month to set
     */
    public void setMonth(String month) {
    this.month = month;
    } /** 
     * Returns the day.
     * @return String
     */
    public String getDay() {
    return day;
    } /** 
     * Set the day.
     * @param day The day to set
     */
    public void setDay(String day) {
    this.day = day;
    } /** 
     * Returns the year.
     * @return String
     */
    public String getYear() {
    return year;
    } /** 
     * Set the year.
     * @param year The year to set
     */
    public void setYear(String year) {
    this.year = year;
    } /** 
     * Returns the id.
     * @return String
     */
    public String getId() {
    return id;
    } /** 
     * Set the id.
     * @param id The id to set
     */
    public void setId(String id) {
    this.id = id;
    }
    }
      

  4.   

    六、对应的持久化类如下:
    /**
     * 航班日程持久化类
     */
    package com.iwtxokhtd.orm;import java.util.Date;/**
     * @author iwtxokhtd
     *
     */
    public class OrderItem { //对应数据库的ID字段为主键
    private long id;

    //Flight持久类对象
    private Flight flight;
    //对应数据库Date字段,航班日程安排
    private Date date; //生成相应的setter和getter方法

    public Date getDate() {
    return date;
    } public void setDate(Date date) {
    this.date = date;
    } public Flight getFlight() {
    return flight;
    } public void setFlight(Flight flight) {
    this.flight = flight;
    } public long getId() {
    return id;
    } public void setId(long id) {
    this.id = id;
    }}
      

  5.   

    七、ORM映射文件OrderItem.hbm.xml文件:
    <?xml version="1.0" encoding='UTF-8'?>
    <!DOCTYPE hibernate-mapping PUBLIC
                                "-//Hibernate/Hibernate Mapping DTD//EN" 
                                "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
                                                     
    <hibernate-mapping>
         <class name="com.iwtxokhtd.orm.OrderItem" table="orderitems" lazy="false">
             <id name="id" column="id" type="long">
               <generator class="increment"/>
             </id>
             
             <property name="date" column="date" type="java.sql.Date" not-null="true"/>
             
             <many-to-one
                name="flight"
                column="flight_id"
                class="com.iwtxokhtd.orm.Flight"
                not-null="true"/>
         </class>
    </hibernate-mapping>
    以及Flight.hbm.xml文件:
    <?xml version="1.0" encoding='UTF-8'?>
    <!DOCTYPE hibernate-mapping PUBLIC
                                "-//Hibernate/Hibernate Mapping DTD//EN" 
                                "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
                                                     
    <hibernate-mapping>
         <class name="com.iwtxokhtd.orm.Flight" table="flights" lazy="false">
             <id name="id" column="id" type="long">
               <generator class="increment"/>
             </id>
             
             <property name="flight_no" column="flight_no" type="string" not-null="true"/>
             <property name="start_place" column="start_place" type="string" not-null="true"/>
             <property name="end_place" column="end_place" type="string" not-null="true"/>
             <property name="time" column="time" type="int" not-null="true"/>
             <property name="price" column="price" type="double" not-null="true"/>
         </class>
    </hibernate-mapping>
      

  6.   

    八、Flight持久化类:
    /**
     * 航班信息持久化类
     */
    package com.iwtxokhtd.orm;import java.io.Serializable;/**
     * @author iwtxokhtd
     *
     */
    public class Flight implements Serializable{ /**
     * 
     */
    private static final long serialVersionUID = 1L;
    private long id;//对应数据库ID字段为主键
    private String flight_no;//航班编号
    private String start_place;//起飞地
    private String end_place;//到达目的地
    private int time;//整个航程的耗时
    private double price;//航班机票价格


    //生成相应的setter和getter方法


    public String getEnd_place() {
    return end_place;
    }
    public void setEnd_place(String end_place) {
    this.end_place = end_place;
    }
    public String getFlight_no() {
    return flight_no;
    }
    public void setFlight_no(String flight_no) {
    this.flight_no = flight_no;
    }
    public long getId() {
    return id;
    }
    public void setId(long id) {
    this.id = id;
    }
    public double getPrice() {
    return price;
    }
    public void setPrice(double price) {
    this.price = price;
    }
    public String getStart_place() {
    return start_place;
    }
    public void setStart_place(String start_place) {
    this.start_place = start_place;
    }
    public int getTime() {
    return time;
    }
    public void setTime(int time) {
    this.time = time;
    }

    }
      

  7.   

    九、Struts-config.xml位于/WEB-INF下:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"><struts-config>
      <data-sources />
      <form-beans >
        <form-bean name="logUserForm" type="com.iwtxokhtd.form.LogUserForm" />
        <form-bean name="adminUserForm" type="com.iwtxokhtd.form.AdminUserForm" />
        <form-bean name="regUserForm" type="com.iwtxokhtd.form.RegUserForm" />
        <form-bean name="manageUserForm" type="com.iwtxokhtd.form.ManageUserForm" />
        <form-bean name="flightBeanForm" type="com.iwtxokhtd.form.FlightBeanForm" />
        <form-bean name="orderItemBeanForm" type="com.iwtxokhtd.form.OrderItemBeanForm" />  </form-beans>  <global-exceptions />
      <global-forwards />
      <action-mappings>
        <action
          attribute="logUserForm"
          input="/index.jsp"
          name="logUserForm"
          path="/log"
          scope="request"
          type="org.springframework.web.struts.DelegatingActionProxy"
          validate="true">
          <forward name="login" path="/view/content.jsp" />
        </action>
        <action
          attribute="adminUserForm"
          input="/admin.jsp"
          name="adminUserForm"
          path="/adminLog"
          scope="request"
          type="org.springframework.web.struts.DelegatingActionProxy">
          <forward name="login" path="/view/admincontent.jsp" />
        </action>
        <action
          attribute="regUserForm"
          input="/view/reg.jsp"
          name="regUserForm"
          path="/reg"
          scope="request"
          type="org.springframework.web.struts.DelegatingActionProxy">
          <forward name="regin" path="/view/regok.jsp" />
        </action>
        <action
          path="/retrieve"
          scope="request"
          type="org.springframework.web.struts.DelegatingActionProxy"
          validate="false">
          <forward name="retrok" path="/view/shoppingcar.jsp" />
        </action>
        <action
          input="/view/purchase.jsp"
          path="/purchase"
          scope="request"
          type="org.springframework.web.struts.DelegatingActionProxy">
          <forward name="purchaok" path="/view/purchaseok.jsp" />
        </action>
        <action
          path="/purchaseReturn"
          scope="request"
          type="org.springframework.web.struts.DelegatingActionProxy">
          <forward name="return" path="/view/content.jsp" />
        </action>
        <action
          path="/indexReturn"
          scope="request"
          type="org.springframework.web.struts.DelegatingActionProxy"
          validate="false">
          <forward name="return" path="/index.jsp" />
        </action>
        <action
          attribute="manageUserForm"
          input="/view/PersonInfo.jsp"
          name="manageUserForm"
          path="/manageUserAct"
          scope="request"
          type="org.springframework.web.struts.DelegatingActionProxy">
          <forward name="manageok" path="/view/content.jsp" />
        </action>
        <action
          attribute="flightBeanForm"
          input="/view/CreateFlight.jsp"
          name="flightBeanForm"
          path="/createFlight"
          scope="request"
          type="org.springframework.web.struts.DelegatingActionProxy" />
        <action
          input="/view/admincontent.jsp"
          path="/readFlight"
          scope="request"
          type="org.springframework.web.struts.DelegatingActionProxy">
          <forward name="readok" path="/view/CreateOrderItem.jsp" />
        </action>
        <action
          attribute="orderItemBeanForm"
          input="/view/admincontent.jsp"
          name="orderItemBeanForm"
          path="/createOrderItem"
          scope="request"
          type="org.springframework.web.struts.DelegatingActionProxy">
          <forward name="createok" path="/view/admincontent.jsp" />
        </action>
        
      </action-mappings>
     <controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor" />
      <message-resources parameter="com.iwtxokhtd.struts.ApplicationResources" null="false" /><plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
     <set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml"/>
    </plug-in>
    </struts-config>
      

  8.   

    applicationContext.xml位于/WEB-INF下:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"><beans>
    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource">
    <ref bean="dataSource" />
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
        <prop key="hibernate.show_sql">true</prop>
    </props>
    </property>
    <property name="mappingResources">
    <list>
    <value>com/iwtxokhtd/orm/Admin.hbm.xml</value>
    <value>com/iwtxokhtd/orm/Flight.hbm.xml</value>
    <value>com/iwtxokhtd/orm/Order.hbm.xml</value>
    <value>com/iwtxokhtd/orm/OrderItem.hbm.xml</value>
    <value>com/iwtxokhtd/orm/User.hbm.xml</value>
    </list>
    </property>
    </bean>
    <bean id="dataSource"
    class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName">
    <value>org.gjt.mm.mysql.Driver</value>
    </property>
    <property name="url">
    <value>jdbc:mysql://localhost/flight</value>
    </property>
    <property name="username">
    <value>root</value>
    </property>
    <property name="password">
    <value>localhost</value>
    </property>
    </bean>
    <bean id="transactionManager"
    class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory">
    <ref local="sessionFactory" />
    </property>
    </bean>
    <bean id="userDAOProxy"
    class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    <property name="transactionManager">
    <ref bean="transactionManager" />
    </property>
    <property name="target">
    <list>
    <ref local="userdao" />
    <ref local="adminlog" />
    <ref local="regdao" />
    <ref local="cardao" />
    <ref local="retrievedao" />
    <ref local="purchasedao" />
    <ref local="managedao" />
    <ref local="flightdao" />
    <ref local="readdao" />
    <ref local="itemdao" />
    </list>
    </property>
    <property name="transactionAttributes">
    <props>
    <prop key="insert*">PROPAGATION_REQUIRED</prop>
    <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
    <prop key="is*">PROPAGATION_REQUIRED,readOnly</prop>
    </props>
    </property>
    </bean>

    <bean id="hibernateTemplate"
    class="org.springframework.orm.hibernate3.HibernateTemplate">
    <property name="sessionFactory">
    <ref bean="sessionFactory" />
    </property>
    </bean>

    <bean id="userdao" class="com.iwtxokhtd.dao.LogUserDao">
    <property name="sessionFactory">
    <ref local="sessionFactory" />
    </property>
    </bean>
    <bean id="adminlog" class="com.iwtxokhtd.dao.LogAdminDao">
    <property name="sessionFactory">
    <ref local="sessionFactory" />
    </property>
    </bean>
    <bean id="regdao" class="com.iwtxokhtd.dao.RegUserDao">
    <property name="sessionFactory">
    <ref local="sessionFactory" />
    </property>
    </bean>
    <bean id="cardao" class="com.iwtxokhtd.dao.ShoppingCarDao">
    <property name="sessionFactory">
    <ref local="sessionFactory" />
    </property>
    </bean>
    <bean id="retrievedao" class="com.iwtxokhtd.dao.RetrieveTicketsDao">
    <property name="sessionFactory">
    <ref local="sessionFactory" />
    </property>
    </bean>
    <bean id="purchasedao" class="com.iwtxokhtd.dao.PurchaseDao">
    <property name="sessionFactory">
    <ref local="sessionFactory" />
    </property>
    </bean>
    <bean id="managedao" class="com.iwtxokhtd.dao.ManageUserDao">
    <property name="sessionFactory">
    <ref local="sessionFactory" />
    </property>
    </bean>
    <bean id="flightdao" class="com.iwtxokhtd.dao.CreateFlightDao">
    <property name="sessionFactory">
    <ref local="sessionFactory" />
    </property>
    </bean>
    <bean id="readdao" class="com.iwtxokhtd.dao.ReadFlightDao">
    <property name="sessionFactory">
    <ref local="sessionFactory" />
    </property>
    </bean>
    <bean id="itemdao" class="com.iwtxokhtd.dao.CreateOrderItemDao">
    <property name="sessionFactory">
    <ref local="sessionFactory" />
    </property>
    </bean>
    <bean name="/log" class="com.iwtxokhtd.action.LogAction"
     singleton="false">
    <property name="userdao">
    <ref bean="userdao" />
    </property>
    </bean>
    <bean name="/adminLog" class="com.iwtxokhtd.action.AdminLogAction"
    singleton="false">
    <property name="adminlog">
    <ref bean="adminlog" />
    </property>
    </bean>
    <bean name="/reg" class="com.iwtxokhtd.action.RegAction"
    singleton="false">
    <property name="regdao">
    <ref bean="regdao" />
    </property>
    </bean>
    <bean name="/retrieve" class="com.iwtxokhtd.action.RetrieveTicketsAction"
    singleton="false">
    <property name="retrievedao">
    <ref bean="retrievedao" />
    </property>
    </bean>
    <bean name="/purchase" class="com.iwtxokhtd.action.PurchaseAction"
    singleton="false">
    <property name="purchasedao">
    <ref bean="purchasedao" />
    </property>
    </bean>
    <bean name="/purchaseReturn"
    class="com.iwtxokhtd.action.PurchaseReturnAction" 
    singleton="false">
    </bean>
    <bean name="/indexReturn"
    class="com.iwtxokhtd.action.IndexReturnAction"
    singleton="false">
    </bean>
    <bean name="/manageUserAct"
    class="com.iwtxokhtd.action.ManageUserAction" 
    singleton="false" >
    <property name="managedao">
    <ref bean="managedao" />
    </property>
    </bean>
    <bean name="/createFlight"
    class="com.iwtxokhtd.action.CreateFlightAction" 
    singleton="false" >
    <property name="flightdao">
    <ref bean="flightdao" />
    </property>
    </bean>
    <bean name="/readFlight"
    class="com.iwtxokhtd.action.ReadFlightAction" 
    singleton="false" >
    <property name="readdao">
    <ref bean="readdao" />
    </property>
    </bean>
    <bean name="/createOrderItem"
    class="com.iwtxokhtd.action.CreateOrderItemAction" 
    singleton="false">
    <property name="itemdao">
    <ref bean="itemdao" />
    </property>
    </bean>
    <bean id="shopcar" class="com.iwtxokhtd.business.ShoppingCar"
     singleton="false">
    <property name="cardao">
    <ref bean="cardao" />
    </property>
    </bean>
    <bean id="purchase" class="com.iwtxokhtd.business.Purchase"
    singleton="false">
    <property name="purchasedao">
    <ref bean="purchasedao" />
    </property>
    </bean></beans>
      

  9.   

    十、orderitems表:
    id(pk) bigint 20  auto_increment
    flight_id bigint 20 not null
    date datetime 19 not null
    flights表:
    id(pk)bigint 20 auto_increment
    flight_no varchar 20 not null
    start_place varchar 20 not null
    end_place varchar 20 not null
    time int 11 not null
    price double 22 not null
      

  10.   

    空指针异常,你看看你要操作的javabean中哪个属性的值为空不就可以了?
      

  11.   

    就是OrderItemBeanForm中的id,year,month,day四个属性的值为空,这个我知道,就是解决不了
      

  12.   

    这四个属性值是通过JSP中的select手动选择值(见上面的CreateOrderItem.jsp),相关联的是:OrderItemBeanForm、OrderItem.hbm.xml,OrderItem等,在上面全部贴出来了
      

  13.   

    CreateOrderItemAction.java:47表示CreateOrderItemAction.java的47行出错,我贴过去看了一下好像是id=new String(id.getBytes("ISO-8859-1"),"gb2312");这里,不知道是不是准确。
    String id=(String)((OrderItemBeanForm)form).getId();
    之后如果id是null,那么id.getBytes("ISO-8859-1")就会抛出空指针异常,要么保证id不是null,要么加上if(id != null)的判断
      

  14.   

    //保存新的航班日程安排 
    if(!itemdao.CreateOrderItem(lid, date)) 
    出错。
    是不是取值没有取到??