Hi there,
I'm trying to migrate a standalone
java application to a webenviroment.
This application consists of multiple classes that get initiated by the good old 'main' method.
My first approach was to just setup one
servlet class, change the application's main method in an arbitrary method name, and just call that method from the servlet.
This servlet is very simple, it has a keyword textfield and a submit button.
When I enter some keywords the servlet passes the keywords via get to the method that was the former main method of the application.
I was surprised to see that the application actually returned the output that I want, the first time i ran the servlet.
However, when I rerun the servlet feeding it different keywords the application stops generating the desired results.
The things i learned about this kind of problem browsing the web:
It could be a scope problem, since the servlet has request scope, while all the other classes do not, since they aren't servlets.
I might try using beans, since they can be set to a particular scope.
But to be honest I don't no how the approach this situation in the first place, should I:
make servlets of the entire application? But should I then have to design all interconnections between classes via service requests etc?
assuming that the application objects are still present in between requests, can't I just destroy the application classes or the references in the application if another request is made by the servlet?
or am I approaching this situation entirely wrong.
Daniel