views:

109

answers:

2

Hey guys, my doubt is pretty simple to understand. I have a sql procedure that generates a util file as its output depending on the input parameters that are passed to it.

I have to pass these parameters from an html page from 3 text boxes.There will also be a button ,on clicking which, the procedure will be called and the util will be generated.

I thought of doing it in jsp and writing the full procedure there itself. But i want to util file to opened in WORD the moment it is generated.

I want to know how to call a procedure using button and how to show the util after its generated.

Thanks guys, any help will be appreciated.

+1  A: 

A few guidelines:

  • JSPs work with the request/response lifecycle. So you have to fire a request (GET preferably) in order to do processing on the server-side
  • don't use JSP to write the processing code. Use servlets, or a framework (Struts2/Spring MVC/etc).
  • the processing code would most likely be using JDBC to fetch information from the database.
  • For generating the file, if I correctly assume should be .doc, you can use Apache POI.
  • in your servlet, after generating the file, take a look at this snipper - it tells you what headers you have to send to the browser in order to have the file downloaded (and opened, if the user wants to).

If you are not familiar with JDBC or POI, you will need to go up a steep learning curve. There is no magical way to generate a file in a desired format.

Bozho
A: 

I PUT THE ANSWER HERE:

http://stackoverflow.com/questions/2409400/how-to-run-a-shell-from-jsp

Thanks for the help guys.

anand