So, as I see you need to create some Web resource on the fly. I don't think that generating of JSP
pages is the right way to approach that. You could have one Servlet
to handle that requests, also it could have some Web resources registry. Simple scenario:
- User clicks on the link /createProductA =>
Servlet
saves this 'productA' with some corresponding information (some details, info, corresponding template to render, etc)
- Then you hit /vewProductA =>
Servlet
handles this too, but know that need to provide the details page. It grabs information from its registry and renders required template. For client it would be the same as a page.
This scenario could help if you need to change rendering templates on the fly, e.g. in database. If your details page layout is static, then you can have one page, e.g. /viewProduct.jsp and pass the id to it. It is a common approach for Java web applications.