Confusion in including jsp and JSTL
I want to structure my jsps like this:
productDetail.jsp includes
1. header.jsp at the top
2. a content page by using <jsp:include page="<fmt:message key="${page}.filename"/>"/>
3. footer.jsp at the bottom
It seems that the <jsp:include> cannot accept the <fmt:message> generated page attribute.
Is there other way to include pages dynamically such as the one above?
Also, another problem is the <fmt:setBundle> inside the header.jsp seems to have no effect inside the content page(no.2)
Please give me suggestions on how to solve these problems
Thx in advance,
davidLimanus
[673 byte] By [
Klincia] at [2007-10-3 2:39:22]

>It seems that the <jsp:include> cannot accept the <fmt:message> generated page attribute.
That is correct. You cannot use a custom tag as an attribute to another custom tag. You could probably do it in two steps though
If you have a JSP 2.0 container, the page understands EL, so:
<fmt:message key="${page}.filename" var="pageName"/>
<jsp:include page="${pageName}"/>
Otherwise it would have to be:
<jsp:include page="<%= pageContext.findAttribute("pageName") %>"/>
><fmt:setBundle> inside the header.jsp seems to have no effect inside the content page(no.2)
What is the scope specified by the setBundle tag?
By default the scope is page scope, so if it is done in your header, it will only affect header.jsp. To be in the other pages, you need to set it at request, session, or application level.
Hope this helps,
evnafets
Thx alot.
The <jsp:include> thing work perfectly.
However the <fmt:setBundle> still can't affect the included page (no.2). I've set it's scope to request or session and the <fmt:message> still can't display anything.
In Eclipse, the <fmt:message> inside the no.2 page is yellow underlined and said that the tag is unknown.
Is there a way to trick this?
Please help.
Thx in advance,
davidLimanus
Oh.. and one more thing..is it possible to specify two bundle to operate at the same time? So that the <fmt:message> will look into each bundle one at a time.
I need to separate my properties, one for storing links, and image paths while the other will store the content text. If I put them in a single properties, I'm affraid it will be surely long.
Thx
davidLimanus
Hi..I actually still can't figure out how to solve my problem. If any of you can help me, please help.
Here are my problems :
1. The <fmt:setBundle>can't affect the included page (no.2). I've set it's scope to request or session and the <fmt:message> still can't display anything.
In Eclipse, the <fmt:message> inside the no.2 page is yellow underlined and said that the tag is unknown.
It seems that when compiled, the content page don't know anything about the other included file (header.jsp) above it. So it assumes that there are no taglib defined already. (I called the taglib declaration at header.jsp)
2. Is it possible to specify two bundle to operate at the same time? So that the <fmt:message> will look into each bundle one at a time. I need to separate text and configuration for links into two bundles.
Please help,
Thx in advance,
davidLimanus