Forums Register Login

Please help: jsp include

+Pie Number of slices to send: Send
Hi,
I have a jsp file created to be a template. This template includes (by the jsp include tag) a file using an String variable called content. It follows:
<%@ include file=content%>
But when I run it, an error occurs:
org.apache.jasper.JasperException: /index.jsp(10,0) /window.jsp(23,22) quote symbol expected
Someone Knows how to solve it?
Thanks!
Joao
+Pie Number of slices to send: Send
change the <%@ include file=content%>
code to:
<%@ include file=<%=content%> %> n it shall work..
+Pie Number of slices to send: Send
Hi Nischal!
I already tried it too...
and the same error message occurs
+Pie Number of slices to send: Send
I believe the file name has to be a string constant. Think about it: the actual include-ing is done before the JSP is translated into Java code, so obviously it happens long before the Java code is actually run. Therefore, you can't use "include" to compute different behaviors.
Depending on what you need to do, you might instead simply use an if-then statement with the contents of the different includes as the alternatives, or forward the incoming request to other JSPs based on the runtime requirements.
+Pie Number of slices to send: Send
Hi
<%@ include file="xyz.html" %> is called static inclusion. Here "xyz.html" can not be an expression. The following is invalid.
<% String content = "xyz.html"; %>
<%@ include file="<%= content %>" %> // invalid
You have to use the Dynamic inclusion
<jsp:include page="<%= content %>" /%> //valid
Thanks
Sainudheen
+Pie Number of slices to send: Send
And don't forget the quote characters.
<%@ include file="content.jsp"%>
bear
+Pie Number of slices to send: Send
Hi all,
I tried to use <jsp:include page="<%= content %>"/%>
But I got another error messaged:
org.apache.jasper.JasperException: /index.jsp(14,0) /window.jsp(23,38) Unterminated
+Pie Number of slices to send: Send
Hi
If possible, try to run the file seperately which the string content is pointing to. Is that a JSP file?
----------------
Sainudheen
+Pie Number of slices to send: Send
there should not the % symbol in the <jsp:include...>
correcte one is
<jsp:include page="<%= content %>"/>
Why am I so drawn to cherry pie? I can't seem to stop. Save me tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2028 times.
Similar Threads
Difference between WAS 6.0 and its previous versions
two questions about struts's template taglib
how to include one html inside another
scanning & deleting unnecessary includes
How do I get the requested url?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 11:01:17.