• Post Reply Bookmark Topic Watch Topic
  • New Topic

Print online Form using Servlets  RSS feed

 
ash neet
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have created an online form for credit account application. I want to print this form using java servlet. I don't know the code and which classes and API's to use for printing. I have been stuck with this for the past 2 days!! any help appreciated.
Thanks in advance!!
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This should get you started: http://www.exampledepot.com/egs/javax.print/pkg.html. Then you'll know which classes and packages to investigate and search for.

Just to make sure: you want to print on the server, right?
 
ash neet
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, thanks for the link. .. and yeah, its on the server. actually I created the form in html and I have given a button "Print" to print the form. Whenever the user opens this form, he/she should be able to print it on clicking the print button. I can do this in javascript but I don't know how to do it in java..
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its on the server.

Whenever the user opens this form, he/she should be able to print it on clicking the print button.

That's a contradiction. Whatever the user does will happen on the client - no servlet is involved. Whatever the servlet does will happen on the server - no client is involved. So which one is it?
 
ash neet
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops! I am sorry. I forgot to mention that now I want to Embedd the html into servlet and I want to print the form through Servlet. That's why server side.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now you've got me even more confused. Earlier you said that the user would click on a print button - but the printout should happen on the server? This would be such an unusual approach that I think you need to explain this use case in more detail; I suspect you're not quite sure about the differences of client-side and server-side in web apps.

And it makes no difference how the HTML is generated.
 
ash neet
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See, actually I was told to create an online credit application form which the user can either fill and Submit Online or she/he can take the Printout and fill offline. I was confused whether i should print the form on the client side or server side.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so the printout happens on the client. That means Java has no part in this, and calling JavaScript's print method is all you can do on the web page.
 
ash neet
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay. Thanks!
I was confused whether printing can happen on the client side or not. I thought i m using some wrong way to print when i used javascript to print the form.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!