下面是我运行当中出现的问题,我下面给出关键代码,希望高手能够帮我解决.

不知道哪里出错了
java.lang.NullPointerException
at
com.opensymphony.xwork2.util.TextParseUtil.translateVariables(TextParseUtil.java:121)
at
com.opensymphony.xwork2.util.TextParseUtil.translateVariables(TextParseUtil.java:100)
at
com.opensymphony.xwork2.util.TextParseUtil.translateVariables(TextParseUtil.java:73)
at
org.apache.struts2.components.Component.findValue(Component.java:313)
at
org.apache.struts2.components.Component.findString(Component.java:194)
at org.apache.struts2.components.Param.end(Param.java:107)
at
org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:43)
at
org.apache.jsp.pmessage_jsp._jspx_meth_s_005fparam_005f0(pmessage_jsp.java:260)
at
org.apache.jsp.pmessage_jsp._jspx_meth_s_005furl_005f0(pmessage_jsp.java:227)
at org.apache.jsp.pmessage_jsp._jspService(pmessage_jsp.java:87)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
at
org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:139)
at
org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:178)
at
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:348)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253)
at
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)
at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)
at
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:186)
at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at
org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at
org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at
com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at
com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:127)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at
org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:107)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:206)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at
com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at
com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at
com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:121)
at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at
org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:123)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)
at
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:504)
at
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:99)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
jsp页面:

        

/s:param
/s:url
“>

    我是做一个修改页面,在hibernate的映射文件出问题了

/s:iterator

    这个是修改前的jsp查询页面:

” width=500 height=500/>

 

这里都能没错,能显示出来,后来加了这段
/s:param
/s:url
“>添加到购物车
就出现错误了。struts.xml:

    <s:iterator value=”#session[‘listuser’]” status=”stx”>
          <tr>
           <td height=”36″ class=gridViewItem style=”WIDTH:
50px”>
            <img src=”../images/bg_users.gif” width=”33″>
           </td>
           <td class=gridViewItem type=”hide”><s:property
value=”id”/></td>
           <td class=gridViewItem><s:property
value=”userid”/></td>
           <td class=gridViewItem><s:property
value=”userusername”/></td>
           <td class=gridViewItem><s:property
value=”userpassword”/></td>
           <td class=gridViewItem><s:property
value=”userrole”/></td>
           <td class=gridViewItem><s:property
value=”userstaffpositions”/></td>
           <td class=gridViewItem><s:property
value=”usersex”/></td>
           <td class=gridViewItem><s:property
value=”userbirthday”/></td>
           <td class=gridViewItem><s:property
value=”useraddress”/></td>
            <td class=gridViewItem><s:property
value=”userimformation”/></td>
           <td class=gridViewItem><s:property
value=”userparty”/></td>
           <td class=gridViewItem><s:property
value=”usertext”/></td>
           
           <td class=gridViewItem>
            <a class=cmdField
href=”editUserInf.action?id=<s:property
value=”id”/>”>更新</a>
           </td>

buy.jsp
action代码:package com.shop.action;
import java.util.List;
import com.shop.bean.Product;
import com.shop.util.ShopCart;
import java.util.Iterator;
import com.opensymphony.xwork2.ActionContext;
import java.util.Collection;
public class CartManager {
private String num;
private String id;
private Collection cartList;

 

public String getId() { return id;}public void setId(String id) { this.id = id;}@SuppressWarnings("unchecked")public String execute()throws Exception{ @SuppressWarningsShopCart cart=ActionContext.getContext().getSession().get;if(cart==null)cart=new ShopCart(); if(cart.checkId(this.getId{ List<Product> products=(List<Product>)ActionContext.getContext().getSession().get("products"); Iterator it=products.iterator(); while(it.hasNext{ Product p=it.next(); if.equals(new Integer(this.getId{ p.setNumber; cart.add(this.getId; ActionContext.getContext().getSession().put("cart", cart); break; } } } return "success";}

      applicationContext配置文件:

public String showCart(){
ShopCart cart=ActionContext.getContext().getSession().get;
this.setCartList(cart.getHashMap().values;
return “success”;
}

 

@SuppressWarnings(“unchecked”)
public String del(){
ShopCart cart=ActionContext.getContext().getSession().get;
cart.del(this.getId;
ActionContext.getContext().getSession().put(“cart”,cart);
return “success”;
}

<?xml version=”1.0″ encoding=”UTF-8″?>
<beans xmlns=””
 xmlns:xsi=””
 xsi:schemaLocation=”
“>

@SuppressWarnings(“unchecked”)
public String update(){
ShopCart cart=ActionContext.getContext().getSession().get;
cart.update(this.getId(),this.getNum;
ActionContext.getContext().getSession().put(“cart”,cart);
return “success”;
}

澳门新葡亰游戏网址, <bean id=”dataSource”
class=”org.apache.commons.dbcp.BasicDataSource”>
  <property name=”driverClassName”
value=”com.mysql.jdbc.Driver”>
  </property>
  <property name=”url”
   value=”jdbc:mysql://127.0.0.1:3306/elu_management_system”>
  </property>
  <property name=”username” value=”root”></property>
  <property name=”password” value=”6131637″></property>
 </bean>
 <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.connection.autocommit”>true</prop>
    <prop key=”show_sql”>true</prop>
   </props>
  </property>
  <property name=”mappingResources”>
   <list>
    <value>com/elu/bean/Boardactivitiestable.hbm.xml</value>
    <value>com/elu/bean/Usertable.hbm.xml</value>
    <value>com/elu/bean/Documenttable.hbm.xml</value>
    <value>
     com/elu/bean/Financialdisbursementtable.hbm.xml
    </value>
    <value>com/elu/bean/Financialincometable.hbm.xml</value>
    <value>com/elu/bean/Gtucotable.hbm.xml</value>
    <value>
     com/elu/bean/Informationpaperstable.hbm.xml
    </value>
    <value>com/elu/bean/Injurytable.hbm.xml</value>
    <value>com/elu/bean/Jmoptable.hbm.xml</value>
    <value>com/elu/bean/Labormonitoringtable.hbm.xml</value>
    <value>com/elu/bean/Laomotable.hbm.xml</value>
    <value>com/elu/bean/Leadingtable.hbm.xml</value>
    <value>com/elu/bean/Mailtable.hbm.xml</value>
    <value>com/elu/bean/Publishedtable.hbm.xml</value>
    <value>
     com/elu/bean/Supervisoryactivitiestable.hbm.xml
    </value>
    <value>com/elu/bean/Trainingtable.hbm.xml</value>
    <value>com/elu/bean/Txtable.hbm.xml</value>
    <value>com/elu/bean/Wxtable.hbm.xml</value>
    <value>com/elu/bean/Xianjitable.hbm.xml</value>
    <value>com/elu/bean/Zhidutable.hbm.xml</value>
    <value>com/elu/bean/Zhuzhitable.hbm.xml</value>
   </list>
  </property>
 </bean>
   <bean id=”transactionInterceptor”
class=”org.springframework.transaction.interceptor.TransactionInterceptor”>          
        <!– 事务拦截器bean需要依赖注入一个事务管理器 –>
        <property name=”transactionManager”
ref=”transactionManager”/>          
        <property name=”transactionAttributes”>  
            <!– 下面定义事务传播属性 –>     
            <props>        
                <prop
key=”add*,save*,update*,delete*”>PROPAGATION_REQUIRED</prop>       
                <prop
key=”find*,get*”>PROPAGATION_REQUIRED,readOnly</prop>        
            </props>        
        </property>               
    </bean>
     <bean
class=”org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator”>          
        <!– 指定对满足哪些bean name的bean自动生成业务代理 –>
        <property name=”beanNames”>
            <!– 下面是所有需要自动创建事务代理的bean –>
            <list>
               <value>userservice</value>
            
            </list>       
        </property>
        <!– 下面定义BeanNameAutoProxyCreator所需的事务拦截器
–>       
        <property name=”interceptorNames”>          
            <list>          
               
<value>transactionInterceptor</value>                       
            </list>          
        </property>          
    </bean>   
 <bean id=”transactionManager”
class=”org.springframework.orm.hibernate3.HibernateTransactionManager”>          
       <property name=”sessionFactory”
ref=”sessionFactory”>          
       </property>          
    </bean>
 <!– 对Dao进行依赖注入 –>
 <bean id=”loginDao” class=”com.elu.daoimpl.LoginDaoImpl”>
  <property name=”sessionFactory”
ref=”sessionFactory”></property>
 </bean>
 <!– 对业务逻辑进行依赖注入 –>
 <bean id=”loginService”
class=”com.elu.serviceimpl.LoginServiceImpl”>
  <property name=”loginDao” ref=”loginDao”></property>
 </bean>
 <!– 对Action进行依赖注入 –>
 <bean id=”loginAction” class=”com.elu.action.LoginAction”>
  <property name=”loginService” ref=”loginService”>
  </property>
 </bean>
 <bean id=”userdaoImpl” class=”com.elu.daoimpl.UserDaoImpl”>
  <property name=”sessionFactory”
ref=”sessionFactory”></property>
 </bean>
 <!– 对业务逻辑进行依赖注入 –>
 <bean id=”userserviceImpl”
class=”com.elu.serviceimpl.UserServiceImpl”>
  <property name=”userdao” ref=”userdaoImpl”></property>
 </bean>
 <!– 对Action进行依赖注入 –>
   <bean id=”userAction” class=”com.elu.action.UserAction”>
  <property name=”userservice”
ref=”userserviceImpl”></property>
 </bean>
</beans>

public Collection getCartList() {
return cartList;
}

 

public void setCartList(Collection cartList) {
this.cartList = cartList;
}

Action文件:

public String getNum() {
return num;
}

 

public void setNum(String num) {
this.num = num;
}
}
不知道是哪里问题。

BaseAction:

[b]问题补充:[/b]
我的意思是这个

package com.elu.action;

/s:param
/s:url
“>

import com.elu.service.DocumentService;
import com.elu.service.EmployService;
import com.elu.service.GtucoService;
import com.elu.service.IuserService;
import com.elu.service.MailService;
import com.elu.service.UserService;
import com.opensymphony.xwork2.ActionSupport;

/s:iterator

public class BaseAction extends ActionSupport {
 /**
  *
  */
 private static final long serialVersionUID = 1L;

” width=500 height=500/>
这个jsp页面的,这里也没有出错,能显示出来,但是加了
/s:param
/s:url
“>添加到购物车这段代码以后就出现错误了,具体的action和配置在上面说得很清楚。我这个是用struts2的,出错应该是在后面的的action或者struts.xml或者是最后的jsp代码上。还是很感谢楼下朋友的热心
[b]问题补充:[/b]
不是这里,应该是/s:param
/s:url
“>添加到购物车这段代码吧!加了它就出错了,不加可以正常运行。可是也没看出事哪里出错了,id这里的值不是空的,我是从数据库中取出来的,所以id的值夜分配了。但是还是出来错误

 UserService userservice;

 DocumentService documentservice;

 EmployService employService;

 MailService mailService;

 IuserService iuserService;
 
 GtucoService gtucoService;

 public GtucoService getGtucoService() {
  return gtucoService;
 }

 public void setGtucoService(GtucoService gtucoService) {
  this.gtucoService = gtucoService;
 }

 public static long getSerialversionuid() {
  return serialVersionUID;
 }

 public IuserService getIuserService() {
  return iuserService;
 }

 public void setIuserService(IuserService iuserService) {
  this.iuserService = iuserService;
 }

 public MailService getMailService() {
  return mailService;
 }

 public void setMailService(MailService mailService) {
  this.mailService = mailService;
 }

 public EmployService getEmployService() {
  return employService;
 }

 public void setEmployService(EmployService employService) {
  this.employService = employService;
 }

 public DocumentService getDocumentservice() {
  return documentservice;
 }

 public void setDocumentservice(DocumentService documentservice) {
  this.documentservice = documentservice;
 }

 public UserService getUserservice() {
  return userservice;
 }

 public void setUserservice(UserService userservice) {
  this.userservice = userservice;
 }
}

UserAction:

public String findbyid() throws Exception {
  System.out.println(“掉到了这个方法”);
  Usertable r = userservice.findById(Integer.parseInt(id));
  System.out.println(“调到了dao层的方法”);
  Map session = ActionContext.getContext().getSession();
  session.put(“id”, this.getId());
  session.put(“usertable”, r);
  return “updataUser”;

 }

dao层:

 

UserDao:

public interface UserDao {
    public  List findAll();//显示所有的成员组成
    public void addUser(Usertable p);//添加一个成员
    public void deleteUser(int id);//删除成员
    public Usertable findById(int id);//修改成员前的成员信息
    public void saveUpdate(Usertable u);//保存修改的信息
}

 

UserDaoImpl:

 public Usertable findById(int id){
  // TODO Auto-generated method stub
  String hql=”from Usertable u where u.id=:”+id;
  Usertable u=(Usertable)this.getHibernateTemplate().load(hql,id);
  System.out.println(“向下传值”);
  return u;
 }

 

Service层:

public interface UserService {
    public  List findAll();//显示所有的成员组成
     public void addUser(Usertable p);//添加一个成员
     public void deleteUser(int id);//删除成员
     public Usertable findById(int id);//修改成员前的成员信息
     public void saveUpdate(Usertable u);//保存修改的信息
}

 

UserServiceImpl:

 

网站地图xml地图