Riyaz Mohd

Greenhorn
+ Follow
since Oct 28, 2013
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Riyaz Mohd

I need to update an existing word template and save it,after saving the word doc,an event sholud be fired and one duplicate copy of it the template sholud be created,is it possible through plain java ??
10 years ago

How to edit and update a word document using Java,i have a scenario where i should be able to open the existing document and when i edit and save it, a duplicate copy of the document should be created and saved,is it possible through java ??
10 years ago

Looks like the default HttpSession timeout is 30 mins,is there any way to increase the timeout duration ?
10 years ago


Hi Jaikiran,

The connection which i mentioned in the post is a database connection,im getting the connection from the datasource whenever i need to display the popup window

JSP code is pasted below:

if (btnname == "viewral")
{
window.open('','viewral','scrollbars=yes,toolbar=no,menubar=yes,width=800,height=550,top=75,left=300');
document.reviewFrn.target="viewral";
document.reviewFrn.formtype.value="RAL";
document.reviewFrn.frn_action.value="viewforms";
document.reviewFrn.action="/usf/FundingRequestServlet";
document.reviewFrn.submit();
}

Portion of code from Servlet where the popup window is getting called:

String sJSPAction = (String) request.getParameter("frn_action");

if ( sJSPAction.equals("viewforms") )
{
Vector forms_vector = new Vector();
// Read the Form type for which view screen is needed.
if( request.getParameter("formtype").equals("RAL"))
{
// Obtaining the Value of the FRN from the JSP editfrn.jsp
frnNo = request.getParameter("formfrn");
USFEnv.getLog().writeDebug( "FRN #"+frnNo, this,null );
// Create db connection for EJB
frnInfoEJBean.connect();
// Get the FRN data
forms_vector = frnInfoEJBean.getRalDataByFrn(frnNo);
// Release db connection for EJB
frnInfoEJBean.release();
// Set the data that has been retreived.
request.setAttribute( "forms_vector",forms_vector);
request.setAttribute( "countForm","false");
// Include the JSP
includeJSP( request, response, FRN_JSP_PATH, "viewral" );
}

From the above code connect() and release() methods are pasted below:

public void connect() throws ConnectException,RemoteException
{
USFEnv.getLog().writeDebug( "creating db connection()" , this , null );
ejbConn = null;
ejbConn = dbconn.open();

if ( ejbConn == null )
{
throw new ConnectException( "Database connection failure" );
}
}
public void release() throws ConnectException,RemoteException
{

try
{
USFEnv.getLog().writeDebug( " release db connection()", this, null );
if ( ejbConn != null )
ejbConn.close();
ejbConn = null;
}
catch( Exception ex )
{
throw new ConnectException( "Database connection not released" );
}
}



The below method is getting called from servlet:


public Vector getRalDataByFrn( String frnNo )
{
StringBuffer query = new StringBuffer( "" );
Vector rals_vector = new Vector();
PreparedStatement pstmt = null;
ResultSet rs = null;

query.append( "select * from stage_ral_form where frn = ? order by email_date" );
USFEnv.getLog().writeDebug( " Get ral form by FRN Query: " + query.toString() , this, null );

try
{
USFEnv.getLog().writeDebug( " Get ral form by FRN Query conn obj: " +conn , this, null );
pstmt = conn.prepareStatement( query.toString() );

pstmt.setString(1,frnNo);

rs = pstmt.executeQuery();

while( rs.next() )
{……
}

Database Connection:


private static DataSource ds = null;
private static java.sql.Connection conn=null;

static {
// Load the type 2 driver
try {

ds = (DataSource)USFEnv.ic.lookup("java:/jboss/datasources/usfdev");

} catch (Exception e) {
USFEnv.getDefaultLog().writeWarn("DataSource could not be found using JNDI ",null,null);
}
10 years ago
In my EJB 2.0 applcation that is running in JBOSS EAP 6,i have a jsp page in which i had 4 buttons,upon clicking on any of the buttons,will display a popup window with some customer information(only informational window),the above described functionality will work fine if server is up for 2/3 hours after it gets bounced,after time duration the popup windows does not fetch any information because it could not get connection object,apart from that functionality, remaining things will work absolutely fine(all the remaining transactions ),i:e i can able to get the connection object for remaining stuff.The above issue gets resolved after doing a server bounce but it stays for only few hours,only the popup window functioanlity is behaving unnaturally,



Any help would be great..
10 years ago