struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guojun Zhu" <>
Subject Programming help for a "print" function
Date Thu, 06 Nov 2008 16:40:13 GMT

I am new to struts and using Struts 1.2.9 (old version, but not my
decision).  I have a view page in jsp set up to display a report I
generated on-fly.  I have use setRequestAtrribute() to put  report (
plain text string with only "\n" line-break) as a attribute in the
action and get it from the jsp page and show it in a "textarea".  I
put it this way for user to copy and paste the content in textarea
into a text editor easily.

 Now we want to put a print link/button for the report.  I have a few questions.

1 Javascript only has "window.print()" which print the whole window.
Can it print things only in the textarea?

2  If I cannot, I probably need to pop-up a new window with a
print-friendly page and invoke "window.print()" there.  Is that the
correct way to do?

3. The report generating is expensive and  it has a generating time in
the report.  So I do not wan to generate it again.  I wan to pass it
into the print-page instead.    how can I pass the report from the
original page to the pop-up print page?  Do I have to change the
report into "session" attribute?

4. Since the plain text spring with line-break "\n" will not show up
correctly in the browser, I need to change the report and put the
format as "<br/>".  So I need to have two versions report generated.
Is that the good way to go?  Or maybe I can generate one xml file and
apply different css?

I am sorry, the questions are not directly related to struts.  But I
am not sure whether struts provide some better mechanism to accomplish
this.  I am new to the server-side programing.  Can anyone point a
good forum or usenet where I can get some help for subject like these?

Zhu, Guojun

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message