Tuesday, 6 August 2013

Need help: thread creation in JSF 1.2

Need help: thread creation in JSF 1.2

The requirement is: Need to start a background process on click of a link.
<h:commandLink action="#{myBean.generateReport}">
<h:outputText value="Generate Report"/>
</h:commandLink>
in the thread - run(),
@Override
public void run()
{
createReport();
}
and in the createReport method,
public String createReport()
{
DatabaseAPI data = new DatabaseAPI();
MyUser ip_user = (MyUser)
sesFactory.get().getAttribute(ProjConstants.SESSION_USER_VAR);
try
{
data.generateReportFunction( .. arguments ..)
}
catch (Exception e)
{
e.printStackTrace();
return "failure";
}
return "success";
}
in the createReport method, the thread get stopped in the following line:
DatabaseAPI data = new DatabaseAPI();
if i comment that line then it get stopped in this line:
MyUser ip_user = (MyUser)
sesFactory.get().getAttribute(ProjConstants.SESSION_USER_VAR);
what could be the reason? Please help me.. my managed bean scope is :
request. Thanks in advance...

No comments:

Post a Comment