aspose file tools*
The moose likes Servlets and the fly likes Is it possible to use the servlet of this scenario? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply locked New topic
Author

Is it possible to use the servlet of this scenario?

Marcos Silvestri
Ranch Hand

Joined: Dec 06, 2009
Posts: 62

Hello mates,

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:

Desired flow:

- 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
Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 530
    
    2

HTTPClient may be your answer.


Regards
KumarRaja

Marcos Silvestri
Ranch Hand

Joined: Dec 06, 2009
Posts: 62

Thanks for the reply Kumar, I'll check on that and see the results, possibly giving an update here of the outcomes.

Cheers from Brazil!
Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 530
    
    2

Cheers and let us know ,if HttpClient is of any use to you
Marcos Silvestri
Ranch Hand

Joined: Dec 06, 2009
Posts: 62

Hi Kumar!

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.

Cheers from Brazil !!!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Is it possible to use the servlet of this scenario?