• Post Reply Bookmark Topic Watch Topic
  • New Topic

Generating dynamic includes with servlet  RSS feed

Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm trying to code my first administration panel, and I have JSP page with menu:

And I have a servlet:

I want to make something like this: When I will click "add" menu item, servlet gets parameter "category" and "action" and it generates an request attribute with jsp:include or c:import (or only path for the included file).
<jsp:include> is executed at runtime right? So passing the "<jsp:include page="data/blog/add.jsp" /> to the parameter and retriving it in the jsp page is senseless and it doesn't work. When I'm trying to pass only path to the included file and my administration page is not even displaying, I see only index page.

I tried something similar with the c:import. I saved "<c:import url="/data/blog/add.jsp" />" in request parameter and I retrived it in the jsp page, but of course it didn't work. I didn't try to save path to the file in request parameter and retrive it in the <c:import> tag, because it doesn't accept EL.

My question is, how to make the JSP page to be a based on request attributes? If theres a category=blog action=add attributes, the page should display form which allows for adding new blog entry. Is it possible?

It's hard for me to explain this, but I hope you will understand :>

Best Regards.

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!