Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to load data from struts2+spring+hibernate by using JspTag

843840Jul 15 2008
I use JspTag to load data from struts2+spring+hibernate,usually I load data from struts2+spring+hibernate using following code:
public class TestAction extends ActionSupport{
    ......
    WebApplicationContextUtils.getRequiredWebApplicationContext().getBean("testDao");
}
It can run well under struts2+spring+hibernate.

Now I use JspTag using above code,like follows:
public class TestTag extends TagSupport{
   public int doStartTag() throws JspException{
       ......
       WebApplicationContextUtils.getRequiredWebApplicationContext().getBean("testDao");

}
This time when I run my TestTag,it raise following error:
Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException

with this statement---> WebApplicationContextUtils.getRequiredWebApplicationContext().getBean("testDao");

My question is how to load data from struts2+spring+hibernate by using JspTag?

Any idea and source code will be appreciated!

Best regards,
Edward
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 12 2008
Added on Jul 15 2008
0 comments
132 views