Hi!
I'm developing a web application focused in DB managing. For that, I'm trying to be as strict as I could with the MVC model.
I've created some
jsp templates for the different objects hold by the DB. e.g, I have a JSP called "competition.jsp" where I show all the details stored about a sport competition. I reach this page from a link, passing as parameter the competition ID to the
servlet, which creates a JavaBean with the data from the DB associated with this competition ID and redirect it to the "competition.jsp" in order to show the data. So, in the browser I get a page named "www.example.com/servlet/competition.jsp", which will be the same for all the different competitions.
The problem is that I think having different URLs for different competitions is quite a lot important. I rejected adding a key to the query like "www.example.com/servlet/competition.jsp?id=123", would prefer to have an URL like "www.example.com/servlet/competitions/world-cup.jsp" or "www.example.com/servlet/competitions/world-cup.html", so I thought about generate a new HTML file from the "competition.jsp", calling it "world-cup.html".
It would be a good practice? Which could be the best practice in this case? Remember that I'm using the MVC
pattern.
Simplifying, I'm doing something like that at now:
I have a link in a page with a javascript that submit the ID to the servlet:
Then in the servlet, I instantiate a bean with the data from de DB, set it as session attribute and redirect to "competition.jsp":
And finally, I show the data of the competition using JSTL:
Thank you in advance,
Hernán.