I have a page that displays several select boxes whose content was acquired
from an oracle datasource that was injected using @Resource(mappedName =
"java:/myDatasource").
The submit button calls a different action class that is to instantiate the
correct DAO, get the data and forward to the appropriate .xhtml. The submit
button fragment is shown here.
| <h:commandButton type="submit" action="#{reportList.submit}"/>
|
The method being called is simulated here.
| @Name("reportList")
| public class ReportListAction implements ReportListLocal {
|
| @Resource(mappedName = "java:/myDatasource")
| private DataSource ds;
|
| private Connection conn = null;
|
| public String submit() {
| // using ds here results in a nullpointer. Why?
| conn = ds.getConnection();
| }
|
| // other setters to receive the form element values
|
| }
|
My problem though is that the datasource that was supposed to be injected into
ReportListAction is null when I try to use it in the submit() method. The
datasource is declared in the exact same manner as the other POJO that gets the
data for the select boxes on the first page. What am I missing?
BTW...I appreciate your help in telling me about the @Resource annotation in an
earlier post.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3959689#3959689
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3959689
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user