Your DBConnect object is probably not in one of the tapestry controlled
packages and thus inject doesn't work. You can inject the Session
directly into your page, or turn your DBConnect object into a tapestry
service by adding it to the services package, and changing the Session
into a constructor argument.
Hope this helps,
Joost
Ashwanth Kumar wrote:
Hi,
I've a problem. I'm using a page which has an actionlink like this:
<a t:type="actionlink" t:id="alid">Link Text</a>
And i've an @OnEvent handler in my Page Class, as follows:
@OnEvent(component="alid")
void function() {
DBConnect db = new DBConnect();
System.out.println(db.getLine());
}
Till, this i've no problem. I've an object called DBConnect which has the
class as follows:
public class DBConnect {
@Inject
Session _session;
public String getLine() {
* List _news = _session.createCriteria(RNews.class).list();*
return _news.getText();
}
}
When i run the actionlink, i get an NullPointer Exception at the bolder line
above (at the _session.createCriteria(RNews.class).list()).. Why does this
happen? Isn't this mean, @Inject is not working, hence the _session is not
initialized??
- Ashwanth Kumar
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org