File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes div content of current jsp into next jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "div content of current jsp into next jsp" Watch "div content of current jsp into next jsp" New topic
Author

div content of current jsp into next jsp

Sahana Hegde
Ranch Hand

Joined: Jan 27, 2008
Posts: 67
Hi guys,

function getExcel()
{
var myVar=document.getElementById("content");

var myVar = document.getElementById("content").innerHTML;

myWin=window.open("/APS/pages/search/windowtest.jsp","myWin","menubar,scrollbars,left=30px,top=40px,height=400px,width=600px");

myWin.focus;

alert(myVar);
myWin.document.getElementById("nextContent").innerHTML =myVar ;

}


Getting a blank excel sheet in the next jsp. Why wont this work.
I have set <%@ page contentType="application/vnd.ms-excel" %> in the next jsp
[ July 18, 2008: Message edited by: sahana hegde ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61206
    
  66

Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along. Please read this for more information.

You can go back and change your post to add code tags by clicking the .


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61206
    
  66

Originally posted by sahana hegde:
I have set <%@ page contentType="application/vnd.ms-excel" %> in the next jsp

That's only going to have an effect when the response is initially received. Using innerHTML after the fact is unlikely to do anything useful.
Sahana Hegde
Ranch Hand

Joined: Jan 27, 2008
Posts: 67
Thanks.
Sorry abt the code. Will be careful when pasting the next time.

So thats not going to work?

I have a jsp that contains the table and it also includes few jsps.
It has to first display it in the browser and by clicking another button it must still remain in the browser but also create a xl and download it.

if I add <%response.setContentType("application/vnd.ms-excel");
it does not display in the browser, it just creates an xl sheet and downloads it.

and also the xl sheet created has the link of the header jsps.

creating a csv and storing it is as an excel sheet is an overhead cause the data keeps changing.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61206
    
  66

Originally posted by sahana hegde:
Sorry abt the code. Will be careful when pasting the next time.

OK, next thing.... please use real words when posting to the forums. Abbreviations such as "abt" in place of "about" only serve to make your posts more difficult to read and less likely to generate useful responses. Please read this for more information.

So thats not going to work?
Probably not.

There are many posts and a FAQ on creating Excel responses. You should be creating this on the server rather than trying to shoe-horn something on the client.
[ July 18, 2008: Message edited by: Bear Bibeault ]
Sahana Hegde
Ranch Hand

Joined: Jan 27, 2008
Posts: 67
ok.Will keep that in mind.
Thanks for the reply. But the data keeps changing.

Lets say user A selects a and b from a drop down. The table is generated.
For different values of the drop down different table is generated.There will be many users using it.
Wouldn't that be an overhead. ?

Thanks for the earlier reply.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61206
    
  66

If you're worried about generation performance, you could cache the results on the server.
Sahana Hegde
Ranch Hand

Joined: Jan 27, 2008
Posts: 67
ok. A stored procedure gets executed each time the choices are made.
Depending on the choices made the stored procedure returns the results and DAO object to retrieve the values returned.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61206
    
  66

So if you feel that you need to cache, take the results and store it in a Map keyed by the input values. Check the Map first before hitting the db.

Are you sure that you're not prematurely optimizing?
Sahana Hegde
Ranch Hand

Joined: Jan 27, 2008
Posts: 67
They already have a system now where for each drop down for each user the xl gets created depending on the options selected. However when the user changes the options sometimes the old xl sheet is still getting displayed.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: div content of current jsp into next jsp