I've got an environment here in which I have not encountered a way to use a servlet to print to the browser since there is no form submission in place. On the other hand, I don't see a way to print to the browser without a servlet, by using its response object.
I describe the environment as follows:
- to upload an Excel document to the server
- to create an Excel file on the server based on the uploaded content
- to read the Excel file on the server and get its content displayed on the brower
Scenario already in place:
a) a view to upload Excel documents through Richfaces;
b) a Java bean to talk to the view and carry out the upload, besides creating an Excel file on the server based on the uploaded content;
c) a Servlet to read the newly-created Excel file on the server and print it out to the browser;
My questions and needs:
1) How to call that servlet from my Java bean? Is it possible to inkove a servlet without a form submit through either get or post methods?
If possible, an alternative could be printing out to the browser directly from my bean. However, this raises the question:
2) Is there a way to print to the browser without the response object and a sintaxe of the type:
In other words, is it possible to print to the browser without a servlet, directly from a bean and without the response object?
Actually, I can either use the servlet or not, depending on the best conclusion and possibilities available for me.
Thanks and regards!
DJ aspirant, Engineering undergraduate, Tokusatsus addicted, fond of English language and Asia's, Buddhist, blogger, etc. I'll need to insert all these attributes in a Java class and manage to create methods for handling my overwhelming life
Fortunately, I received an aid from my co-worker, he remembered me that I was within the Java Server Faces environment, and thus I did not need to be concerned about using Servlets directly. Instead, I could've obtained a response object through JSF, and I ended up doing it, as follows:
With the response object above, I had no more problems to print to the browser.
In the end, I did not use HttpClient, but thanks anyway, it's nice to know it is available when needed in the future.