Two Laptop Bag*
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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Cannot use jsp scriplet in jsp taglibs" Watch "Cannot use jsp scriplet in jsp taglibs" New topic
Author

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: 47

Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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

try:



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
Marshal

Joined: Jan 10, 2002
Posts: 61449
    
  67

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]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cannot use jsp scriplet in jsp taglibs