Spring-Version: 2.0.2
tomcat 6我用的如下代码:
public class x extends SimpleTagSupport{
...
@Override
public void doTag() throws JspException, IOException {
ServletContext servletContext = ((PageContext) this.getJspContext()).getServletContext();
WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(servletContext);
ExpenseItemService expenseItemService = (ExpenseItemService) wac.getBean("expenseItemService",ExpenseItemService.class); //在这行抛java.lang.NullPointerException
...
}}
tomcat 6我用的如下代码:
public class x extends SimpleTagSupport{
...
@Override
public void doTag() throws JspException, IOException {
ServletContext servletContext = ((PageContext) this.getJspContext()).getServletContext();
WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(servletContext);
ExpenseItemService expenseItemService = (ExpenseItemService) wac.getBean("expenseItemService",ExpenseItemService.class); //在这行抛java.lang.NullPointerException
...
}}
//etc...
@Override
public void doTag() throws JspException, IOException {
ServletContext servletContext = ((PageContext) this.getJspContext()).getServletContext();
WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(servletContext);
ExpenseItemService expenseItemService = (ExpenseItemService) wac.getBean("expenseItemService",ExpenseItemService.class); //在这行抛java.lang.NullPointerException
//etc...
}}
getWebApplicationContext=null
getRequiredWebApplicationContext=IllegalStateException Exception