Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
    Bookmark Topic Watch Topic
  • New Topic

Is it possible to use the servlet of this scenario?

 
Marcos Silvestri
Ranch Hand
Posts: 62
Chrome Java Mac
  • Mark post as helpful
  • send pies
  • Report post to moderator
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!
 
Kumar Raja
Ranch Hand
Posts: 547
2
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
HTTPClient may be your answer.
 
Marcos Silvestri
Ranch Hand
Posts: 62
Chrome Java Mac
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 547
2
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
Cheers and let us know ,if HttpClient is of any use to you
 
Marcos Silvestri
Ranch Hand
Posts: 62
Chrome Java Mac
  • Likes 1
  • Mark post as helpful
  • send pies
  • Report post to moderator
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 !!!
 
    Bookmark Topic Watch Topic
  • New Topic