We know that we can use taglibs in JSP page. Is it possible to refer tlds and its tags from the servlets. Can we have control over the taglibs in the servlet programmatically ? I googled but invain. All the results are about creating custom taglibs.
Answer is NO! Tag lib is just to use functions of java in jsp page, why to use library in servlet when you have java core functions already there.
Can you give me example when would you use that in servlets?
What I do to create reports from database is iReport.
You can draw what kind of report you want, then convert that to jasper report.
When you have it done it is just sending list of values to that report and he will know how to hande it.
So you will have something like this.
Press button to generate report let say monthly sales.
Your servlet is called, he goes in database grab all values that he need.
Send that values to this compiled jasper report.
And you specify how would that report look like. I always put PDF.
Then after clicking on button user will get pdf opened with values you need.
I don't know what kind of report you need I never work with that kind of taglbis, if you want I can show you my code how it generates PDF with jasper reports.
Now only i heard about iReport.
Thats sounds great. But I couldn't implement that iReport in the ongoing project because its almost done. I will give a try to it later. I would be greatful to you if you could tell me more about iReport.
Let me come to this topic. There is NO solution to this issue. So,I changed my approach. Thanks to The AJAX. Eventhough we have AJAXified many things in the project, it didn't come to my mind. As I changed the logic slightly, again I'm on the right track.
So, that approach is :
Before generating that report, we need to do some analytics. An analytical tool(R) will execute a set of modules that creat a temporary table in the database from which that reporting tool will fetch the information.
java code needed to call that analytics modules(is synchronized) will be given in that servlet(which I planned to create). The existing taglibs are not modified and are allowed to stay in their JSP page.
After getting the form information from the UI, I wont send those data to the jsp where taglibs live. Instead , I send only two params(of entire form data) to the servlet via ajax.
When the servlet finishes its job, it returns a status to UI.
After knowing the servlet has done, again the UI send those temporarily stored form data in a new request to the jsp page of that taglibs. now its done.
Thanks for your time and ideas milil. Thank you so much.