tags:

views:

448

answers:

3

I am not sure where to begin with this error message. I have tried googling, but I was never able to nail down a solid reason why I am getting this message.

I have looked at various jsp tutorials and they all seem relatively simple so I don't see the problem.

I am writing another plugin for JetBrains TeamCity and have been passing values back and forth between my java code and jsp code with parameters like this:

${parameterName}

Whenever I try to put in real jsp code with tags like

<%= new java.util.Date() %>

This throws this error.

<%!, <jsp:declaration, <%=, <jsp:expression, <%, <jsp:scriptlet ) are disallowed here

Any help or suggestions are appreciated.

+2  A: 

Are scriptlets disallowed in the application? Look for <scripting-invalid>true</scripting-invalid> in your web.xml file.

Scriptlets were a mistake. They make it too easy to mingle presentation and logic. So this flag was added to prevent developers from using them in an application and encourage Expression Language and tag libraries instead.

erickson
+1. I've been out of JSP world for too long, completely forgot about this one
ChssPly76
ahh ok I don't have that in there. I am googling now on it, but where do I add it in the web.xml file? I tried just thowing it in at the beginning, but i still get the same error message. I am sure this is the problem now though, and thanks so much for pointing me in the right direction.
cozmokramer8
No wait I am being dumb, I don't have that so scripting should be enabled, right? I think it is enabled by default and this is a clean install i am working on so it should be enabled anyway. Do I have to edit it to say <scripting-invalid>false</scripting-invalid>? I don't think i should have to so I guess the question is still unresolved :(
cozmokramer8
Yes, by default scripting is enabled. If this element doesn't appear at all, this isn't the problem.
erickson
A: 

I am also facing the same issue. I figured out that the problem occurs when I use scripting tag inside a custom tag. I guess the scripting-invalid or similar things can be defined for a tag too. Just a pointer.

Gautam
A: 

You can scripting/scriptlets on and off for different url patterns, so it could be off for .tag files but on for .jsp if necessary. Below is an example, try setting scripting-invalid to false for the file extensions you want to use, maybe that will override the default if JBoss defaults to true:

<jsp-config>
    <jsp-property-group>
        <url-pattern>*.jsp</url-pattern>
        <scripting-invalid>true</scripting-invalid>
    </jsp-property-group>
    <jsp-property-group>
        <url-pattern>*.tag</url-pattern>                
        <scripting-invalid>true</scripting-invalid>
    </jsp-property-group>
</jsp-config>
morganizeit