permaculture playing cards*
The moose likes JSP and the fly likes Cannot use jsp scriplet in jsp taglibs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Cannot use jsp scriplet in jsp taglibs" Watch "Cannot use jsp scriplet in jsp taglibs" New topic

Cannot use jsp scriplet in jsp taglibs

rajshkhr pandey
Ranch Hand

Joined: Oct 14, 2009
Posts: 35
Hello to all,

I am using <jsp:include /> to include the page but cannot use use jsp scriplet into it

it gives me error

How can I include page dynamically

Thanks In Advance.
pamir sonmez
Ranch Hand

Joined: May 31, 2010
Posts: 46

Ben Souther

Joined: Dec 11, 2004
Posts: 13410

The jsp:include tag should not be inside your scriptlet.


Also, I would avoid using scriptlets.
If you're server supports JSP 2.0 or better use EL as Pamir Sommez suggested.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Kris Schneider
Ranch Hand

Joined: Feb 14, 2001
Posts: 71
The error in the original post is usually caused by a scriptlet expression that does not appear by itself as an attribute value. For example, this should work fine:

But this will cause the error:

By the way, don't use page for the scripting variable name, it's already defined as an implicit object...
rajshkhr pandey
Ranch Hand

Joined: Oct 14, 2009
Posts: 35
Thanks all for your your response,

I have used following code also but it is not working as "Kris Schneider" says it is causing error

It is causing the same error

Are scriplets allowed in <jsp:include> tag?

Thanks in advance..........

Edited "<%pg" changed to "<%=pg%>"
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60765

No matter what you do, if your syntax is wrong, it's going to blow up!

Check your syntax!

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
It is sorta covered in the JavaRanch Style Guide.
subject: Cannot use jsp scriplet in jsp taglibs
Similar Threads
a recursive include?
Help with JSTL usage
include file in jsp
Problem with forward and include JSP tag
can i use page for jsp standard actions