SSH框架调用方法时service为空

这是调用

 StaffManageAction staffManageAction = new StaffManageAction();
        staffManageAction.staffListQuery();

图片说明
这里service是空
别的项目调用这个接口service有值

1个回答

定义的service没有注入

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
SSH框架中@Service 调用问题,急求大神解答!

我手头有个ssh项目框架,通过jsp页面操作,到Action中依次调用Service、Dao等方法进行操作。我现在需要在其他类中调用该Action中的Service的方法。先看图:这是某个Action中有个sdkDeployService,使用了@Resource注入。下面是Action内容: ![这个是Action内容](https://img-ask.csdn.net/upload/201603/29/1459236674_270359.png) 这个是Service: ![图片说明](https://img-ask.csdn.net/upload/201603/29/1459236743_529741.png) 这个是ServiceImpl: ![图片说明](https://img-ask.csdn.net/upload/201603/29/1459236784_373609.png) 我在其他地方这样写的: @Autowired private SdkDeployService sdkDeployService; sdkDeployService.deploy(); 结果显示:在sdkDeployService.deploy() 这里java.lang.NullPointerException.报空指针。求大神告诉,ssh里如何获得并调用service里的方法。急求,万分感谢!!

ssh框架,接口实现类调用service方法报空指针异常

``` //**实现类代码** String tname = saleName; String id = goodIds; //调用service层方法,传入两个参数。报空指针 int count = tpcCombinationSaleService.querySaleindexName(tname, id); //**service代码** public int querySaleindexName(String indexName,String id) throws com.sinovatech.common.exception.AppException; //**impl代码** @Override public int querySaleindexName(String indexName,String id) throws com.sinovatech.common.exception.AppException { indexName = indexName.trim(); String sql=""; if(!id.equals("")){ sql = "select * from DATA_RRYX.T_PC_COMBINATION_SALE Z where Z.NAME='" + indexName + "' and Z.id <> '"+id+"' and Z.is_delete = 'N'"; }else{ sql = "select * from DATA_RRYX.T_PC_COMBINATION_SALE Z where Z.NAME='" + indexName + "' and Z.is_delete = 'N'"; } return tpcCombinationSaleDAO.getRecordCountBySQL(sql); ``` 以上为代码,现在我运行测试类正常传参进去后,debug的时候走到调用service方法,没有走方法内部,就直接跳转到Thread类,的dispatchUncaughtException方法,然后就报了空指针异常,请问大佬们可能的原因是在哪里?

ssh中在action中调用service中的方法出现空指针异常

public class LinkManAction extends ActionSupport implements ModelDriven<LinkMan>{ private LinkManService linkManService; public void setLinkManServie(LinkManService linkManServie) { this.linkManService = linkManService; } //注入客户的service对象 private CustomerService customerService; public void setCustomerService(CustomerService customerService) { this.customerService = customerService; } //1到新增联系人页面的方法 public String toAddPage(){ //1.1查询所有客户,把所有客户list集合传递到页面中显示 //调用客户service里面的方法得到所有客户 List<Customer> listCustomer = customerService.findAll(); ServletActionContext.getRequest().setAttribute("listCustomer", listCustomer); return "toAddPage"; } //2 联系人列表的方法 public String list() { List<LinkMan> list = linkManService.listLinkMan(); ServletActionContext.getRequest().setAttribute("list", list); return "list"; } } type Exception report message description The server encountered an internal error that prevented it from fulfilling this request. exception java.lang.NullPointerException cn.itcast.action.LinkManAction.list(LinkManAction.java:87) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:891) ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1293) ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68) com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo(XWorkMethodAccessor.java:117) com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethod(XWorkMethodAccessor.java:108) ognl.OgnlRuntime.callMethod(OgnlRuntime.java:1369) ognl.ASTMethod.getValueBody(ASTMethod.java:90) ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212) ognl.SimpleNode.getValue(SimpleNode.java:258) ognl.Ognl.getValue(Ognl.java:494) ognl.Ognl.getValue(Ognl.java:458) com.opensymphony.xwork2.ognl.OgnlUtil$2.execute(OgnlUtil.java:309) com.opensymphony.xwork2.ognl.OgnlUtil.compileAndExecute(OgnlUtil.java:340) com.opensymphony.xwork2.ognl.OgnlUtil.getValue(OgnlUtil.java:307) com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:423) com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:287) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:250) org.apache.struts2.interceptor.DeprecationInterceptor.intercept(DeprecationInterceptor.java:41) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:76) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:229) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:229) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) org.apache.struts2.interceptor.DateTextFieldInterceptor.intercept(DateTextFieldInterceptor.java:125) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:253) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:139) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:564) org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81) org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99) org.springframework.orm.hibernate5.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:151) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

SSH项目 Action调用Service层的方法失败。

使用注解方式集成SSH框架,但是在Action中调用service的方法,没有进入该方法, 不知道为什么。求解。。

ssh框架中action,service,dao,之间的逻辑关系

我想知道在ssh框架中,action,service,dao三者的分工,和彼此之间的逻辑关系,最好用例子来解释!谢谢

SSH框架 action不能进入service

这个问题是偶发性的 我在本地运行不能复现这个问题 但是服务器上会偶尔出现 特别是早上最开始运行的几次 我在每个地方都打了注释 进入action后service已经注入成功了 但是还是会出现那样 跑到进入service那一行的时候就没反应了 然后直接跳出来![图片说明](https://img-ask.csdn.net/upload/201711/08/1510117960_406733.png),![图片说明](https://img-ask.csdn.net/upload/201711/08/1510117968_728821.png),![图片说明](https://img-ask.csdn.net/upload/201711/08/1510117978_255240.png) ,![图片说明](https://img-ask.csdn.net/upload/201711/08/1510117989_675606.png)

ssh框架,能否在将Service类作为某个静态方法的参数

<div class="iteye-blog-content-contain" style="font-size: 14px;"> <p>因为一些需要,想在Utile类中设置一个公用的静态方法来处理一些共同的逻辑,方式如下</p> <pre name="code" class="java">public static StudentInfo checkUser(String userId,UserService userService,StudentInfoService studentInfoService,......) throws Exception{ User user = userService.getById(userId); StudentInfo studentInfo = null; ..... return studentInfo; }</pre> <p> 这样做是否符合规范?会不会引发什么问题?例如:在多个Action同时调用该方法的时候会不会出现互相影响的情况?</p> <p> </p> <p> </p> <p> </p> </div>

如何在非action的普通java类中调用service和dao来操作数据库

web程序用的框架是SSH的,在spring.xml中通过<context:component-scan base-package="com.xxx" />方式自动扫描service和dao,现有一个后台消息处理类,要在该类调用其他service和dao进行一些业务和数据库的操作,使用@Autowired private BaseDaoI<T> baseDao;引用dao,在调用时报空指针错误,请教大神们该怎么解决。

Java EE SSH 框架,想让不同角色进入不同界面。

Java EE SSH 框架,数据表设有name,password,role字段。JSP中role角色设置单选按钮,(消费者,管理员)想根据role的不同,将消费者和管理员指定到不同的界面。数据表如下所示:![图片说明](https://img-ask.csdn.net/upload/201706/10/1497099279_324705.png)

ssh使用多工程怎么依赖springboot,springboot框架要怎么搭建

1、ssh使用多工程的依赖的项目,因为使用restful接口,现在小程序是用PHP开发的要进行对接,现在使用restful接口进行对接会暴露的,想用springboot依赖ssh工程的service,将springboot给小程序PHP调用,请问要怎么搭建springboot框架,怎么跟ssh工程的service进行依赖。 2、ssh框架,jkd1.7

这段代码Service运行会报空指针异常

代码如下 ``` //查询 @ApiOperation(value="船东发布展示信息列表", notes="船东发布展示信息列表的接口") @RequestMapping(value = "/findContent" , method = RequestMethod.POST) @ApiImplicitParams({ @ApiImplicitParam(name="startDate", value="开始时间", required=false), @ApiImplicitParam(name="endDate", value="结束时间", required=false), @ApiImplicitParam(name="startLoading", value="最小吨数", required=false), @ApiImplicitParam(name="endLoading", value="最大吨数", required=false), @ApiImplicitParam(name="typeShip", value="船舶类型", required=false), @ApiImplicitParam(name="emptyPort", value="港口", required=false) }) public SysResult find(Date startDate,Date endDate , String startLoading , String endLoading, Long typeShip , Long emptyPort){ try{ EntityWrapper<ShipRelease> wrapper = new EntityWrapper<>(); //只能状态为发布中的数据展示出来 wrapper.where( "state = {0} ", 4 ); //筛选时间日期 if(startDate != null && endDate != null) { wrapper.where( "empty_date >= {0} ", startDate ); wrapper.and( " empty_date <= {0}", endDate ); } //筛选两数值之剑 if(startLoading != null && endLoading != null) { wrapper.where( "tonnage_loading >= {0} ", startLoading ); wrapper.and( " tonnage_loading <= {0}", endLoading ); } //筛选类型1 if(typeShip != null) wrapper.where("type_ship={0}", typeShip); //筛选类型2 if(emptyPort != null) wrapper.where("empty_port={0}", emptyPort); wrapper.setSqlSelect("id, title,empty_date,aircraft_sky,tonnage_loading,type_ship"); List<ShipRelease> shipReleaseList = webShipownerReleaseShowMapper.selectList( wrapper ); return SysResult.ok(shipReleaseList); }catch (Exception e){ e.printStackTrace(); return SysResult.build(201,"查询失败"); } } ``` 这段代码我写在Controller上是可以运行的,但是我想写到Service上,现在问题是我写到Service上的话会报空指针异常,请问要如何解决这个问题呢 [同一问题](https://ask.csdn.net/questions/753635 "同一问题") 使用框架是spring-boot+mybatisPlus

线程的run()方法中注入service应该怎样做?

ssh框架,要将一个controller中的方法实现线程,由于controller是单例模式,打算将线程放在service,线程的run()方法中注入service应该怎样做?

SSH框架配置sessionFactory无法实例化问题

这是报错信息,求大神帮帮忙,弄了一个多星期了 java.lang.NullPointerException at call.dao.impl.buttonCallDaoImpl.addcall(buttonCallDaoImpl.java:22) at call.service.impl.buttonCallServiceImpl.addcall(buttonCallServiceImpl.java:21) at call.web.buttonCallAction.addcall(buttonCallAction.java:33) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252) at org.apache.struts2.interceptor.DeprecationInterceptor.intercept(DeprecationInterceptor.java:41) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:249) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:249) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:139) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:562) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:233) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 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(Thread.java:619) 下面是applicationContext.xml的配置 <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.format_sql">true</prop> <prop key="hibernate.hbm2ddl.auto">update</prop> </props> </property> <!-- 实体类注解扫描包列表 --> <property name="packagesToScan"> <list> <value>call.entity</value> </list> </property> </bean> 而且我也配了 default-autowire="byName" default-lazy-init="true" dao层: public class CommonDaoImpl<T> extends HibernateDaoSupport implements CommonDao<T> { @Resource(name = "sessionFactory") public void setSuperSessionFactory(SessionFactory sessionFactory) { super.setSessionFactory(sessionFactory); }

SSH框架报错找不到action,求大神指教

我是用 ``` <a class="more" href="/stage/charge/ordershow.action"> ``` 跳转,但是报There is no Action mapped for action name ordershow.错,新手求指教 错误: ``` 六月 06, 2016 11:32:02 上午 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn 警告: Could not find action or result There is no Action mapped for action name ordershow. - [unknown location] at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189) at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61) at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39) at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:475) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:521) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) ``` strust.xml配置: ``` <?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.enable.DynamicMethodInvocation" value="false" /> <constant name="struts.devModel" value="true" /> <include file="json-default.xml" /> <include file="struts-default.xml" /> <package name="login" extends="json-default"> <action name="ordershow" class="orderAction" method="show"> <result name="show">/stage/order/order_info.jsp</result> </action> </package> <constant name="struts.i18n.encoding" value="UTF-8" /> <constant name="struts.locale" value="zh_CN" /> <constant name="struts.ui.theme" value="simple" /> <constant name="struts.ui.templateDir" value="template" /> <constant name="struts.ui.templateSuffix" value="ftl" /> </struts> ``` web.xml: ``` <?xml version="1.0" encoding="UTF-8" ?> <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> <display-name></display-name> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <filter> <filter-name>struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter </filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>*.action</url-pattern> </filter-mapping> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:/spring-*.xml </param-value> </context-param> </web-app> ``` jsp: ``` <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ taglib uri="/struts-tags" prefix="s"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> <!DOCTYPE html> <!--[if IE 8]> <html lang="en" class="ie8"> <![endif]--> <!--[if IE 9]> <html lang="en" class="ie9"> <![endif]--> <!--[if !IE]><!--> <html lang="en"> <!--<![endif]--> <!-- BEGIN HEAD --> <head> <meta charset="utf-8" /> <title>Ttuo-Hotel | 酒店管理系统</title> <meta content="width=device-width, initial-scale=1.0" name="viewport" /> <meta content="" name="description" /> <meta content="" name="author" /> <link href="../assets/bootstrap/css/bootstrap.min.css" rel="stylesheet" /> <link href="../assets/css/metro.css" rel="stylesheet" /> <link href="../assets/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" /> <link href="../assets/font-awesome/css/font-awesome.css" rel="stylesheet" /> <link href="../assets/fullcalendar/fullcalendar/bootstrap-fullcalendar.css" rel="stylesheet" /> <link href="../assets/css/main_style.css" rel="stylesheet" /> <link href="../assets/css/style_responsive.css" rel="stylesheet" /> <link href="../assets/css/style_default.css" rel="stylesheet" id="style_color" /> <link rel="stylesheet" type="text/css" href="../assets/chosen-bootstrap/chosen/chosen.css" /> <link rel="stylesheet" type="text/css" href="../assets/uniform/css/uniform.default.css" /> <link rel="shortcut icon" href="../favicon.ico" /> </head> <!-- END HEAD --> <!-- BEGIN BODY --> <body class="fixed-top"> <!-- BEGIN HEADER --> <div class="header navbar navbar-inverse navbar-fixed-top"> <!-- BEGIN TOP NAVIGATION BAR --> <div class="navbar-inner"> <div class="container-fluid"> <!-- BEGIN LOGO --> <a class="brand" href="index.html"> <img src="../assets/img/logo11.png" alt="logo" /> </a> <!-- END LOGO --> <!-- BEGIN RESPONSIVE MENU TOGGLER --> <a href="javascript:;" class="btn-navbar collapsed" data-toggle="collapse" data-target=".nav-collapse"> <img src="../assets/img/menu-toggler.png" alt="" /> </a> <!-- END RESPONSIVE MENU TOGGLER --> <!-- BEGIN TOP NAVIGATION MENU --> <ul class="nav pull-right"> <!-- BEGIN NOTIFICATION DROPDOWN --> <li class="dropdown" id="header_notification_bar"><a href="#" class="dropdown-toggle" data-toggle="dropdown"> <i class="icon-warning-sign"></i> <span class="badge">6</span> </a> <ul class="dropdown-menu extended notification"> <li> <p>You have 14 new notifications</p> </li> <li><a href="javascript:;" onclick=App.onNotificationClick(1);> <span class="label label-success"><i class="icon-plus"></i> </span> New user registered. <span class="time">Just now</span> </a> </li> <li><a href="#"> <span class="label label-important"><i class="icon-bolt"></i> </span> Server #12 overloaded. <span class="time">15 mins</span> </a> </li> <li><a href="#"> <span class="label label-warning"><i class="icon-bell"></i> </span> Server #2 not respoding. <span class="time">22 mins</span> </a> </li> <li><a href="#"> <span class="label label-info"><i class="icon-bullhorn"></i> </span> Application error. <span class="time">40 mins</span> </a> </li> <li><a href="#"> <span class="label label-important"><i class="icon-bolt"></i> </span> Database overloaded 68%. <span class="time">2 hrs</span> </a> </li> <li><a href="#"> <span class="label label-important"><i class="icon-bolt"></i> </span> 2 user IP blocked. <span class="time">5 hrs</span> </a> </li> <li class="external"><a href="#">See all notifications <i class="m-icon-swapright"></i> </a> </li> </ul> </li> <!-- END NOTIFICATION DROPDOWN --> <!-- BEGIN INBOX DROPDOWN --> <li class="dropdown" id="header_inbox_bar"><a href="#" class="dropdown-toggle" data-toggle="dropdown"> <i class="icon-envelope-alt"></i> <span class="badge">5</span> </a> <ul class="dropdown-menu extended inbox"> <li> <p>You have 12 new messages</p> </li> <li><a href="#"> <span class="photo"><img src="../assets/img/avatar2.jpg" alt="" /> </span> <span class="subject"> <span class="from">Lisa Wong</span> <span class="time">Just Now</span> </span> <span class="message"> Vivamus sed auctor nibh congue nibh. auctor nibh auctor nibh... </span> </a> </li> <li><a href="#"> <span class="photo"><img src="../assets/img/avatar3.jpg" alt="" /> </span> <span class="subject"> <span class="from">Richard Doe</span> <span class="time">16 mins</span> </span> <span class="message"> Vivamus sed congue nibh auctor nibh congue nibh. auctor nibh auctor nibh... </span> </a> </li> <li><a href="#"> <span class="photo"><img src="../assets/img/avatar1.jpg" alt="" /> </span> <span class="subject"> <span class="from"></span> <span class="time">2 hrs</span> </span> <span class="message"> Vivamus sed nibh auctor nibh congue nibh. auctor nibh auctor nibh... </span> </a> </li> <li class="external"><a href="#">See all messages <i class="m-icon-swapright"></i> </a> </li> </ul> </li> <!-- END INBOX DROPDOWN --> <!-- BEGIN TODO DROPDOWN --> <li class="dropdown" id="header_task_bar"><a href="#" class="dropdown-toggle" data-toggle="dropdown"> <i class="icon-tasks"></i> <span class="badge">5</span> </a> <ul class="dropdown-menu extended tasks"> <li> <p>You have 12 pending tasks</p> </li> <li><a href="#"> <span class="task"> <span class="desc">New release v1.2</span> <span class="percent">30%</span> </span> <span class="progress progress-success "> <span style="width: 30%;" class="bar"></span> </span> </a> </li> <li><a href="#"> <span class="task"> <span class="desc">Application deployment</span> <span class="percent">65%</span> </span> <span class="progress progress-danger progress-striped active"> <span style="width: 65%;" class="bar"></span> </span> </a> </li> <li><a href="#"> <span class="task"> <span class="desc">Mobile app release</span> <span class="percent">98%</span> </span> <span class="progress progress-success"> <span style="width: 98%;" class="bar"></span> </span> </a> </li> <li><a href="#"> <span class="task"> <span class="desc">Database migration</span> <span class="percent">10%</span> </span> <span class="progress progress-warning progress-striped"> <span style="width: 10%;" class="bar"></span> </span> </a> </li> <li><a href="#"> <span class="task"> <span class="desc">Web server upgrade</span> <span class="percent">58%</span> </span> <span class="progress progress-info"> <span style="width: 58%;" class="bar"></span> </span> </a> </li> <li><a href="#"> <span class="task"> <span class="desc">Mobile development</span> <span class="percent">85%</span> </span> <span class="progress progress-success"> <span style="width: 85%;" class="bar"></span> </span> </a> </li> <li class="external"><a href="#">See all tasks <i class="m-icon-swapright"></i> </a> </li> </ul> </li> <!-- END TODO DROPDOWN --> <!-- BEGIN USER LOGIN DROPDOWN --> <li class="dropdown user"><a href="#" class="dropdown-toggle" data-toggle="dropdown"> <img alt="" src="../assets/img/avatar1_small.jpg" /> <span class="username"></span> <i class="icon-angle-down"></i> </a> <ul class="dropdown-menu"> <li><a href="extra_profile.html"><i class="icon-user"></i> 我的信息</a> </li> <li><a href="calendar.html"><i class="icon-calendar"></i> 我的日历</a> </li> <li><a href="#"><i class="icon-tasks"></i> 我的任务</a> </li> <li class="divider"></li> <li><a href="hotel.jsp"><i class="icon-key"></i> 退出登录</a> </li> </ul> </li> <!-- END USER LOGIN DROPDOWN --> </ul> <!-- END TOP NAVIGATION MENU --> </div> </div> <!-- END TOP NAVIGATION BAR --> </div> <!-- END HEADER --> <!-- BEGIN CONTAINER --> <div class="page-container row-fluid"> <!-- BEGIN SIDEBAR --> <div class="page-sidebar nav-collapse collapse"> <!-- BEGIN SIDEBAR MENU --> <ul> <li> <!-- BEGIN SIDEBAR TOGGLER BUTTON --> <div class="sidebar-toggler hidden-phone"></div> <!-- BEGIN SIDEBAR TOGGLER BUTTON --> </li> <li> <!-- BEGIN RESPONSIVE QUICK SEARCH FORM --> <form class="sidebar-search"> <div class="input-box"> <a href="javascript:;" class="remove"></a> <input type="text" placeholder="查询. . ." /> <input type="button" class="submit" value=" " /> </div> </form> <!-- END RESPONSIVE QUICK SEARCH FORM --> </li> <li class="has-sub "> <a href="/hotel/index.jsp"> <i class="icon-home"></i> <span class="title">首页</span> <span class="selected"></span> </a> </li> <li class="start active"> <a href="/hotel/stage/stage.jsp"> <i class="icon-bookmark-empty"></i> <span class="title">前台</span> <span class="arrow "></span> </a> <ul class="sub"> <li><a href="/hotel/stage/charge/charge_info.jsp">入住开单</a></li> <li><a href="/hotel/jie">入住详情</a></li> <li><a href="ordershow.action">预定开单</a></li> <li><a href="/hotel/orderfood/food!food.action">订餐服务</a></li> <li><a href="Vip.action">会员管理</a></li> </ul> </li> <li class="has-sub "> <a href="/hotel/restaurant/catering.jsp"> <i class="icon-th-list"></i> <span class="title">餐饮部</span> <span class="arrow "></span> </a> <ul class="sub"> <li><a href="/hotel/restaurant/basic/basic.jsp">餐饮信息</a> </li> <li><a href="/hotel/restaurant/enter/enter!show.action">采购入库</a> </li> <li><a href="/hotel/restaurant/stock/stock.jsp">库存盘点</a> </li> <li><a href="/hotel/restaurant/purchase/purchase!show.action">取材出库</a> </li> </ul> </li> <li class="has-sub "> <a href="/hotel/room/room.jsp"> <i class="icon-star-empty"></i> <span class="title">客房部</span> <span class="arrow "></span> </a> <ul class="sub"> <li><a href="/hotel/room/basic/basic.jsp">基本设置</a> </li> <li><a href="/hotel/room/roommanage/roommanage.jsp">客房管理</a> </li> <li><a href="/hotel/room/damage/damage!show.action">损坏设备统计</a> </li> </ul> </li> <li class="has-sub "> <a href="javascript:;"> <i class="icon-table"></i> <span class="title">统计</span> <span class="arrow "></span> </a> <ul class="sub"> <li ><a href="statistic/room_pie.jsp">房间总体情况</a></li> <li ><a href="statistic/room_stack.jsp">各类型房间情况</a></li> </ul> </li> <li class="has-sub "> <a href="javascript:;"> <i class="icon-briefcase"></i> <span class="title">部门档案</span> <span class="arrow "></span> </a> <ul class="sub"> <li ><a href="department/deptc!show.action">部门分类</a></li> <li ><a href="department/dept!show.action">部门信息</a></li> <li ><a href="department/staff!show.action">人员档案</a></li> </ul> </li> <li class="has-sub "> <a href="javascript:;"> <i class="icon-map-marker"></i> <span class="title">地图</span> <span class="arrow "></span> </a> <ul class="sub"> <li><a></a></li> </ul> </li> <li class="has-sub "> <a href="javascript:;"> <i class="icon-map-marker"></i> <span class="title">公告</span> <span class="arrow "></span> </a> <ul class="sub"> <li><a></a></li> </ul> </li> <li class="has-sub "> <a href="javascript:;"> <i class="icon-briefcase"></i> <span class="title">其他</span> <span class="arrow "></span> </a> <ul class="sub"> <li><a href="profile/profile.jsp">我的信息</a></li> <li><a href="profile/calendar.jsp">我的日程</a></li> <li><a>我的任务</a></li> </ul> </li> <li class=""> <a href="hotel.jsp"> <i class="icon-user"></i> <span class="title">退出登陆</span> </a> </li> </ul> <!-- END SIDEBAR MENU --> </div> <!-- END SIDEBAR --> <div class="page-content"> <!-- BEGIN PAGE CONTAINER--> <div class="container-fluid"> <!-- BEGIN PAGE HEADER--> <div class="row-fluid"> <div class="span12"> <!-- BEGIN STYLE CUSTOMIZER --> <div class="color-panel hidden-phone"> <div class="color-mode-icons icon-color"></div> <div class="color-mode-icons icon-color-close"></div> <br> <div class="color-mode"> <p>主题 颜色</p> <ul class="inline"> <li class="color-black current color-default" data-style="default"></li> <li class="color-blue" data-style="blue"></li> <li class="color-brown" data-style="brown"></li> <li class="color-purple" data-style="purple"></li> <li class="color-white color-light" data-style="light"></li> </ul> <label class="hidden-phone"> <input type="checkbox" class="header" checked value="" /> <span class="color-mode-label">固定标题</span> </label> </div> </div> <!-- END BEGIN STYLE CUSTOMIZER --> <!-- BEGIN PAGE TITLE & BREADCRUMB--> <h3 class="page-title"> 前台<small>请选择内容进行操作:</small> </h3> <ul class="breadcrumb"> <li><i class="icon-home"></i> <a href="/hotel/index.jsp">首页</a> <i class="icon-angle-right"></i> </li> <li><a href="javascript:;">前台</a> </li> </ul> <!-- END PAGE TITLE & BREADCRUMB--> </div> </div> <!-- END PAGE HEADER--> <!-- BEGIN PAGE CONTENT--> <div class="row-fluid"> <div class="span12"> <div id="dashboard"> <!-- BEGIN DASHBOARD STATS --> <div class="row-fluid"> <div class="span2 responsive" data-tablet="span6" data-desktop="span2"> <div class="dashboard-stat yellow"> <div class="visual"> <img src="../assets/img/icon/resize_png_new4.png"> </div> <div class="details"> <div class="number">入住开单</div> <div class="desc"></div> </div> <a class="more" href="/hotel/stage/charge/charge_info.jsp"> 点击浏览更多 <i class="m-icon-swapright m-icon-white"></i> </a> </div> </div> <div class="span2 responsive" data-tablet="span6" data-desktop="span2"> <div class="dashboard-stat green"> <div class="visual"> <img src="../assets/img/icon/33216.png"> </div> <div class="details"> <div class="number">入住详情</div> <div class="desc"></div> </div> <a class="more" href="/hotel/jie"> 点击浏览更多 <i class="m-icon-swapright m-icon-white"></i> </a> </div> </div> <div class="span2 responsive" data-tablet="span6 fix-offset" data-desktop="span2"> <div class="dashboard-stat purple"> <div class="visual"> <img src="../assets/img/icon/resize_png_new7.png"> </div> <div class="details"> <div class="number">预定开单</div> <div class="desc"></div> </div> <a class="more" href="/stage/charge/ordershow.action"> 点击浏览更多 <i class="m-icon-swapright m-icon-white"></i> </a> </div> </div> <div class="span2 responsive" data-tablet="span6 fix-offset" data-desktop="span2"> <div class="dashboard-stat green"> <div class="visual"> <img src="../assets/img/icon/548346.png"> </div> <div class="details"> <div class="number">订餐服务</div> <div class="desc"></div> </div> <a class="more" href="/hotel/orderfood/food!food.action"> 点击浏览更多 <i class="m-icon-swapright m-icon-white"></i> </a> </div> </div> <div class="span2 responsive" data-tablet="span6 fix-offset" data-desktop="span2"> <div class="dashboard-stat yellow"> <div class="visual"> <img src="../assets/img/icon/resize_png_new6.png"> </div> <div class="details"> <div class="number">会员管理</div> <div class="desc"></div> </div> <a class="more" href="Vip.action"> 点击浏览更多 <i class="m-icon-swapright m-icon-white"></i> </a> </div> </div> </div> </div> <!-- END DASHBOARD STATS --> </div> </div> </div> <!-- END PAGE CONTENT--> </div> <!-- END PAGE CONTAINER--> </div> <!-- END PAGE --> <!-- BEGIN FOOTER --> <div class="footer"> 2014 &copy; Ttuo-Hotel | by ToTeam <div class="span pull-right"> <span class="go-top"><i class="icon-angle-up"></i> </span> </div> </div> <!-- END FOOTER --> <!-- BEGIN JAVASCRIPTS --> <!-- Load javascripts at bottom, this will reduce page load time --> <script src="../assets/js/jquery-1.8.3.min.js"></script> <script src="../assets/breakpoints/breakpoints.js"></script> <script src="../assets/jquery-slimscroll/jquery-ui-1.9.2.custom.min.js"></script> <script src="../assets/bootstrap/js/bootstrap.min.js"></script> <script src="../assets/js/jquery.blockui.js"></script> <script src="../assets/js/jquery.cookie.js"></script> <script src="../assets/fullcalendar/fullcalendar/fullcalendar.min.js"></script> <script type="text/javascript" src="../assets/uniform/jquery.uniform.min.js"></script> <script type="text/javascript" src="../assets/chosen-bootstrap/chosen/chosen.jquery.min.js"></script> <!-- ie8 fixes --> <!--[if lt IE 9]> <script src="assets/js/excanvas.js"></script> <script src="assets/js/respond.js"></script> <![endif]--> <script src="../assets/js/app.js"></script> <script> jQuery(document).ready(function() { // initiate layout and plugins App.setPage('calendar'); App.init(); }); </script> <!-- END JAVASCRIPTS --> </body> <!-- END BODY --> </html> ``` ``` ``` java文件: ``` package com.hotel.action.stage; import java.util.ArrayList; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; import com.hotel.entity.stage.Orderlist; import com.hotel.entity.stage.RoomAll; import com.hotel.service.stage.OrderService; import com.hotel.utils.Encode; import com.opensymphony.xwork2.ActionSupport; @Controller("orderAction") @Scope("prototype") public class OrderAction extends ActionSupport { @Autowired @Qualifier("orderService") private OrderService os; private Orderlist orderlist = new Orderlist(); private ArrayList<Orderlist> list1 = new ArrayList<Orderlist>(); ArrayList<RoomAll> list2 = new ArrayList<RoomAll>(); private String idds; private int id; private String number; public String save() { orderlist.setName(Encode.toutf8(orderlist.getName())); os.save(orderlist, idds); return "order1"; } public String show() { list1 = os.show(); return "show"; } public String getone() { list2 = os.getone(number); return "get1"; } public String getNumber() { return number; } public void setNumber(String number) { this.number = number; } public int getId() { return id; } public void setId(int id) { this.id = id; } public Orderlist getOrderlist() { return orderlist; } public ArrayList<Orderlist> getList1() { return list1; } public void setList1(ArrayList<Orderlist> list1) { this.list1 = list1; } public void setOrderlist(Orderlist orderlist) { this.orderlist = orderlist; } public String getIdds() { return idds; } public void setIdds(String idds) { this.idds = idds; } public ArrayList<RoomAll> getList2() { return list2; } public void setList2(ArrayList<RoomAll> list2) { this.list2 = list2; } } ``` 程序结构: ![图片说明](https://img-ask.csdn.net/upload/201606/06/1465185272_322367.png) jsp文件位置: ![图片说明](https://img-ask.csdn.net/upload/201606/06/1465185442_652255.png) jar包: ![图片说明](https://img-ask.csdn.net/upload/201606/06/1465185533_60648.png) ![图片说明](https://img-ask.csdn.net/upload/201606/06/1465185546_855720.png)

ssh框架使用动态数据源通过aop动态切换数据源数据源没有切换成功。

在开启事务情况下进入service1使用db1数据源,执行service中调用了service2使用db2数据源,在service2中第一次执行sql成功,第二次使用createSQLQuery 执行sql报错,报错提示为:db1中这个表不存在。 在service2中我明明是用着db2的数据源,可是却报db1不存在表。 求大佬帮忙。 两个service都有事务注解,是因为事务才报的错吗?还是是因为createSQLQuery不支持多数据源呀? ![图片说明](https://img-ask.csdn.net/upload/201907/03/1562119999_810688.png)![图片说明](https://img-ask.csdn.net/upload/201907/03/1562120008_404931.png)![图片说明](https://img-ask.csdn.net/upload/201907/03/1562120017_180812.png)

写了一些SSH的公共 Action 和 DAO方法。想作为jar包

写了一些SSH的公共 Action 和 DAO方法。想作为jar包引入,但是启动的时提示找不到类,比如模型类型 ,调用action也是报错,说找不到,但是把jar包里面的解压放到工程目录就可以。 这是什么原因?我应该怎么解决?

Spring自动装配报空指针异常。

Spring自动装配一个hibernateManage,第一个方法login()调用它的时候一切OK,第二个方法listRecordByUserId()调用它的时候却报空指针异常,为什么? ![图片说明](https://img-ask.csdn.net/upload/201702/28/1488247389_631782.png)

SSH框架中设计问题

<p>我遇到的疑惑 </p> <p> </p> <p><strong>--action</strong> <br>   --CommonAction</p> <p>   --AAction</p> <p>   --BAction</p> <p>   --CAction</p> <p> </p> <p><strong>--service</strong></p> <p>   ---AService</p> <p>   ---BService</p> <p> <br><strong>--service.impl</strong></p> <p>   --AServiceImpl</p> <p>   --BServiceImpl <br>  </p> <p><strong>--dao</strong></p> <p>  --ADao</p> <p>  --BDao</p> <p> <br><strong>--dao.impl</strong></p> <p>  --ADaoImpl</p> <p>  --BDaoImpl</p> <p> </p> <p> </p> <pre name="code" class="java">public abstract class CommonAction extends DispatchAction{ public AService aService; pulbic BService bService; ...setter/getter } </pre> <p> </p> <pre name="code" class="java">public class BAction extends CommonDispatchAction { public ActionForward getList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)throws Exception { List&lt;a&gt; aList = aService.getAList(); List&lt;B&gt; bList = bService.getBList(); ...}}</pre> <pre name="code" class="java">public class AServiceImpl implements AService { private ADao aDao; ...setter/getter public void add(A a) { aDao.add(a); } public List&lt;a&gt; getAList(){ return aDao.getAList(); } ... } </pre> <p> </p> <p>问题1:我的一个service对应一个dao,service种方法和dao中方法一模一样,而且service实现类中仅仅是调用dao方法。这种实现方法有什么不妥,好的实现方式是什么?</p> <p> </p> <p>问题2:如上代码,我想在 BAction 中获得A数据或者C,D,E,F ... 数据只能先定义一个抽象类CommonAction,这样实现方法的弊端是什么,如果我想实现这个功能(在 BAction 中获得A数据或者C,DE,F数据),应该怎样设计?</p>

使用struts,action中始终接收不到前端传来的参数

要崩溃了。。。。。。。。。。。求助。。。。。。。。。。。。。。 网页部分只有一个form表单: ``` <form method="post" action="login.action" name="form"> <input name="user.username" placeholder="用户名" type="text"> <input name="user.password" placeholder="密码" type="password"> <input value="登录" style="width: 100%;" type="submit"> </form> ``` 请求的action: ``` <action name="login" class="com.struts.action.IndexAction" method="login"> <result name="failed">/error.html</result> <result name="success">/index.html</result> </action> ``` model部分: ``` public class UserModel { private String username; private String password; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } } ``` action方法: ``` private UserModel user; public UserModel getUserModel() { return user; } public void setUserModel(UserModel userModel) { this.user = userModel; } public String login() throws Exception{ String name = getUserModel().getUsername(); //此处为第49行,报错 String password = getUserModel().getPassword(); System.out.println("name : " + name + " password : " + password); return "failed"; } ``` 错误信息: ``` Type Exception Report Description The server encountered an unexpected condition that prevented it from fulfilling the request. Exception java.lang.NullPointerException com.struts.action.IndexAction.login(IndexAction.java:49) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450) com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252) org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:161) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:563) org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99) Note The full stack trace of the root cause is available in the server logs. ``` web.xml中的配置: ``` <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> <display-name>MyWebset</display-name> <welcome-file-list> <welcome-file>launch.html</welcome-file> </welcome-file-list> <!-- 配置struts2过滤器 --> <filter> <!-- 配置Struts2核心Filter的名字 --> <filter-name>my</filter-name> <!-- 统一处理 --> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> <!-- 初始编码设置 --> <init-param> <!-- 配置Struts2框架默认加载的Action包结构,可以没有。 --> <param-name>struts.i18n.encoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <!-- 配置Filter拦截的URL --> <filter-mapping> <filter-name>my</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app> ```

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

Java基础知识面试题(2020最新版)

文章目录Java概述何为编程什么是Javajdk1.5之后的三大版本JVM、JRE和JDK的关系什么是跨平台性?原理是什么Java语言有哪些特点什么是字节码?采用字节码的最大好处是什么什么是Java程序的主类?应用程序和小程序的主类有何不同?Java应用程序与小程序之间有那些差别?Java和C++的区别Oracle JDK 和 OpenJDK 的对比基础语法数据类型Java有哪些数据类型switc...

我以为我学懂了数据结构,直到看了这个导图才发现,我错了

数据结构与算法思维导图

String s = new String(" a ") 到底产生几个对象?

老生常谈的一个梗,到2020了还在争论,你们一天天的,哎哎哎,我不是针对你一个,我是说在座的各位都是人才! 上图红色的这3个箭头,对于通过new产生一个字符串(”宜春”)时,会先去常量池中查找是否已经有了”宜春”对象,如果没有则在常量池中创建一个此字符串对象,然后堆中再创建一个常量池中此”宜春”对象的拷贝对象。 也就是说准确答案是产生了一个或两个对象,如果常量池中原来没有 ”宜春” ,就是两个。...

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

Linux面试题(2020最新版)

文章目录Linux 概述什么是LinuxUnix和Linux有什么区别?什么是 Linux 内核?Linux的基本组件是什么?Linux 的体系结构BASH和DOS之间的基本区别是什么?Linux 开机启动过程?Linux系统缺省的运行级别?Linux 使用的进程间通信方式?Linux 有哪些系统日志文件?Linux系统安装多个桌面环境有帮助吗?什么是交换空间?什么是root帐户什么是LILO?什...

Linux命令学习神器!命令看不懂直接给你解释!

大家都知道,Linux 系统有非常多的命令,而且每个命令又有非常多的用法,想要全部记住所有命令的所有用法,恐怕是一件不可能完成的任务。 一般情况下,我们学习一个命令时,要么直接百度去搜索它的用法,要么就直接用 man 命令去查看守冗长的帮助手册。这两个都可以实现我们的目标,但有没有更简便的方式呢? 答案是必须有的!今天给大家推荐一款有趣而实用学习神器 — kmdr,让你解锁 Linux 学习新姿势...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

史上最全的 python 基础知识汇总篇,没有比这再全面的了,建议收藏

网友们有福了,小编终于把基础篇的内容全部涉略了一遍,这是一篇关于基础知识的汇总的文章,请朋友们收下,不用客气,不过文章篇幅肯能会有点长,耐心阅读吧爬虫(七十)多进程multiproces...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

85后蒋凡:28岁实现财务自由、34岁成为阿里万亿电商帝国双掌门,他的人生底层逻辑是什么?...

蒋凡是何许人也? 2017年12月27日,在入职4年时间里,蒋凡开挂般坐上了淘宝总裁位置。 为此,时任阿里CEO张勇在任命书中力赞: 蒋凡加入阿里,始终保持创业者的冲劲,有敏锐的...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

新一代神器STM32CubeMonitor介绍、下载、安装和使用教程

关注、星标公众号,不错过精彩内容作者:黄工公众号:strongerHuang最近ST官网悄悄新上线了一款比较强大的工具:STM32CubeMonitor V1.0.0。经过我研究和使用之...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

大学一路走来,学习互联网全靠这几个网站,最终拿下了一把offer

大佬原来都是这样炼成的

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

为什么你不想学习?只想玩?人是如何一步一步废掉的

不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...

什么时候跳槽,为什么离职,你想好了么?

都是出来打工的,多为自己着想

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

你期望月薪4万,出门右拐,不送,这几个点,你也就是个初级的水平

先来看几个问题通过注解的方式注入依赖对象,介绍一下你知道的几种方式@Autowired和@Resource有何区别说一下@Autowired查找候选者的...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

立即提问
相关内容推荐