How To Dynamically Include Page Fragments

View: New views
2 Messages — Rating Filter:   Alert me  

How To Dynamically Include Page Fragments

by FromDotNetToJava :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

All,

Environment: Netbeans 6.1, Glassfish v2. I am relatively new to Java (< 6 months) and trying to dynamically include 1 of 4 page fragments (jspf) in my jsp page. I have attempted to use the following jsp element in the page source:

<jsp:directive.include file="#{publications$article.mainPanelContent}"/>

Glassfish generates the following error at runtime:

File "/publications/#{publications$article.getMainPanelContent}" not found.

When I use a static file reference (file="../resources/fragments/publications/article/*.jspf") for the include, everything works fine. I have a public getter "getMainPanelContent" in the jsp page that should return 1 of the 4 page fragment file paths.

Any guidance you provide would be appreciated. Thanks.

Chris
Thanks,

Chris

Re: How To Dynamically Include Page Fragments

by autozoom :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

you can try

<jsp:include page="#{publications$article.mainPanelContent}"/>

FromDotNetToJava wrote:
All,

Environment: Netbeans 6.1, Glassfish v2. I am relatively new to Java (< 6 months) and trying to dynamically include 1 of 4 page fragments (jspf) in my jsp page. I have attempted to use the following jsp element in the page source:

<jsp:directive.include file="#{publications$article.mainPanelContent}"/>

Glassfish generates the following error at runtime:

File "/publications/#{publications$article.getMainPanelContent}" not found.

When I use a static file reference (file="../resources/fragments/publications/article/*.jspf") for the include, everything works fine. I have a public getter "getMainPanelContent" in the jsp page that should return 1 of the 4 page fragment file paths.

Any guidance you provide would be appreciated. Thanks.

Chris