How do i direct my servlet to a new window using JQuery i am not able
to understand as i am new to JQuery, can you please suggest me how do i do
this i tried doing
window.opener.location.href=
$.post(../reports/BillIDPropIDExcelExport,{csvstring:
$(#vname1).val(),count:$(#vname2).val(),propType:$(#vname3).val(),instValue:$(#vname4).val()},function(data){
alert(data);document.body.style.cursor=default; });
this gives me errors window.opener.location is null or not an object
Can you please suggest me how do i direct my servlet out put to new window
using AJAX.
On Sat, Jan 10, 2009 at 1:19 PM, jQuery Lover ilovejqu...@gmail.com wrote:
Create a new window and direct it to your servlet url then onload.close();
Read jQuery HowTo Resource - http://jquery-howto.blogspot.com
On Thu, Jan 8, 2009 at 7:08 PM, ruquia ruquiatabas...@gmail.com wrote:
Hi i am calling a servlet using JQuery and my servlets create an excel
file at runtime and provides the option for the user to open save or
cancel the file created
JQuery code is
$.post(../reports/BillIDPropIDExcelExport,{csvstring: $
(#vname1).val(),count:$(#vname2).val(),propType:$(#vname3).val
(),instValue:$(#vname4).val()},function(data){
alert(data);document.body.style.cursor=default; });
and my servlets that creates the file at runtime is
try
{
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet(Customer Details
Connection
Fee);
HSSFDataFormat format = wb.createDataFormat();
HSSFCellStyle cstyle;
cstyle = wb.createCellStyle();
cstyle.setDataFormat(format.getFormat(#,###,###.00));
HSSFRow row = sheet.createRow((short)0);
HSSFCell c0=row.createCell((short)0);
HSSFCell c1=row.createCell((short)1);
HSSFCell c2=row.createCell((short)2);
c0.setCellValue(CHAR_PREM_ID);
c1.setCellValue(SA_TYPE_CD);
c2.setCellValue(UOM_CD);
c0.setCellStyle(style);
c1.setCellStyle(style);
c2.setCellStyle(style);
String
acplotnumber=,finalcsvstring=,finalacplotnumber1=;
String csvstring=request.getParameter(csvstring);
System.out.println(csvstring);
String count=request.getParameter(count);
System.out.println(count);
String instValue1=request.getParameter(instValue);
String propType1=request.getParameter(propType);
if(propType1.length()==4)
propType='CONBASE','CONGROW';
else
propType='+propType1+';
d= new OracleDatabaseConnectionPROD();
connection=d.connect();
//System.out.println(OracleDatabaseConnectionPROD);
stmt = connection.createStatement();
connection.setAutoCommit(false);
{
rs=stmt.executeQuery(SELECT A.CHAR_PREM_ID, SA_TYPE_CD,
F.UOM_CD,
C.BILL_ID, SUM(CALC_AMT) as CALC_AMOUNT from Customers);
while(rs.next())
{
String CHAR_PREM_ID=rs.getString(1);
String SA_TYPE_CD=rs.getString(2);
String UOM_CD=rs.getString(3);
String BILL_ID=rs.getString(4);
float CALC_AMOUNT=rs.getFloat(5);
HSSFCellStyle style1 = wb.createCellStyle();
HSSFFont font1 = wb.createFont();
font1.setFontHeightInPoints((short)8);
style1.setFont(font1);
row = sheet.createRow((short)j);
// bold
HSSFCell cell0 =row.createCell((short)0);
HSSFCell cell1 =row.createCell((short)1);
HSSFCell cell2 =row.createCell((short)2);
cell0.setCellValue(CHAR_PREM_ID);
cell1.setCellValue(SA_TYPE_CD);
cell2.setCellValue(UOM_CD);
cell0.setCellStyle(style1);
cell1.setCellStyle(style1);
j++;
}
//FileOutputStream fileOut = new
FileOutputStream(fname
+ExtractBillID+dateFormat+.xls);
//wb.write(fileOut);
//fileOut.close();
String filename=ExtractBillID+dateFormat+.xls;