ssh action调用sevice层方法
空指针状况
代码[code=Java][/code]package action;
import model.User;
import service.UserService;
import com.opensymphony.xwork2.ActionSupport;
import java.util.List;
@SuppressWarnings("serial")
public class UserAction extends ActionSupport{
	private String      password;
	private List<User>  userList;
	private String      username;
	private UserService userService;
	public String getPassword() {
		return password;
	}	
	public String getUsername() {
		return username;
	}
	public UserService getUserService() {
		return userService;
	}
	public String login(){
		System.out.println(username);
		userList=userService.Login(username, password);
		if(userList.size()>0&&userList!=null){
			return SUCCESS;
		}
		else{
			return ERROR;
		}
	}
	public void setPassword(String password) {
		this.password = password;
	}	
	public void setUsername(String username) {
		this.username = username;
	}
	public void setUserService(UserService userService) {
		this.userService = userService;
	}
	public void setUserList(List<User> userList) {
		this.userList = userList;
	}
	public List<User> getUserList() {
		return userList;
	}
}
[code=Java][/code]package service.impl;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import dao.UserDao;
import model.User;
import service.UserService;
@Component("userService")
public class UserServiceImpl implements UserService {
	private UserDao userDao;
	public List<User> Login(String name,String pwd) {
		// TODO Auto-generated method stub
		List<User> userList=userDao.findByNameAndPwd(name, pwd);
		if(userList.size()>0&&userList!=null){
			return userList;
		}
		else{
			return null;
		}
	}
	@Resource
	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}
	public UserDao getUserDao() {
		return userDao;
	}
	public UserServiceImpl(){		
	}
}
[code=XML][/code]<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
            http://www.springframework.org/schema/context
            http://www.springframework.org/schema/context/spring-context-2.5.xsd
            http://www.springframework.org/schema/aop
            http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
            http://www.springframework.org/schema/tx  
            http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"
            default-autowire="byName"
            default-lazy-init="true"
            >
	<context:annotation-config />
	<context:component-scan base-package="com.rec" />
	<bean
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="locations">
			<value>classpath:jdbc.