• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

call Javascript function from jsp page.

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can we call javascript functions from a jsp page.

example say i have a link "print" in a.html linked to printview.jsp page.
once user clicks on print link.. it takes him to printview.jsp at the same time I would like to initiate the javascript print funtion to show user print the windows dialog.

Thanks
Sirisha.
[ November 17, 2004: Message edited by: Sirisha Reddy ]
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
on the printview.jsp page jsp add an onload handler to the body

<body onload="javascript:window.print()">

Clicking the link will not be able to call the print function in that window.
 
Sirisha Reddy
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks !!
 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eric, and why exactly he need to put a label "javascript:" in onload?

(you know, it works just because JavaScript thinks, that "javascript:" in that example is a label)
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ah, that does not have to be there, must have been asleep when I coded that! LOL

i just needs to be

<body onload="window.print()">
reply
    Bookmark Topic Watch Topic
  • New Topic