I’m going to write my first Java based web app, and I’m sort of lost how to begin.
Firstly, I would like a web app and a desktop app that do pretty much the same thing, without the hackish idea of embedding a web browser into the desktop app because that doesn’t allow to easily make changes to the desktop without affecting the web app and vice versa.
Now, here my questions.
-
Right now, I have a bunch of POJOs and they communicate with a single class that, right now, uses a flat file as a “database”, of course, in production, I would use a legitimate database and just change that single class. Is this a good idea? Will I be able to go from POJOs to a web app?
-
Should I use a framework? I would like to have this app written pretty soon, seeing that all the buisness logic is there, I just need to wrap it so its usable, so, I don’t want to spend an extreme amount of time learning, say, Spring (which AFAIK is huge), but, I don’t want to keep reinventing the wheel throughout my app either. I can always just use JSP and scriptlets…
-
If you said yes to the above, what framework(s) do you suggest? Please note that I would like a framework that I can start using in maybe 3-4 weeks of learning.
-
Will I have to start from scratch with the POJOs that I have written? They’re well over 30k LOC, so, if it is like that, I’ll be hesitant.
You should definitely use a framework as otherwise sooner or later you’ll end up writing your own.
If you use maven then simply typing
mvn archetype:generatewill give you a huge list of frameworks to choose from and it’ll set up all of the scaffolding for you so you can just play with a few frameworks until you find the one that works for you.Spring has good documentation and is surprisingly easy to get started with. Don’t be put off by the pages of documentation! You could use JPA to store stuff in the database. You should (in theory) just be able to annotate your existing POJO’s to denote primary keys and so on and it should just work. You can also use JSP’s within Spring if that makes life easier.