Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Scripting Invalid and EL Ignored elements not working?

 
Amandeep Singh
Ranch Hand
Posts: 850
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am unable to disable the scripting neither the EL,

i have included these elements under web.xml ::

<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<scripting-invalid>true</scripting-invalid>
<el-ignored>true</el-ignored>
</jsp-property-group>
</jsp-config>


But then also this is working perfect generating the output.

<%
//ServletRequest pc = pageContext.getRequest();
Enumeration hobbies1 = pc.getParameterNames();
while(hobbies1.hasMoreElements()){
out.print("<tr>");
out.print("<td>");
out.print("<i>");
out.println(hobbies1.nextElement());
out.print("</i>");
out.print("</td>");
out.print("</tr>");
out.println("<br>");
}
%>


Please advice.
 
Dee Brown
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This can occur as a result of a non-standard "web.xml" file.

According to google:
1) For a JSP 2.0 container, you should be using JSTL 1.1, and you should have your web application declared as a Servlets 2.4 web app by using the Servlets 2.4 XML Schema.
2) For a JSP 1.x container, you should be using JSTL 1.0, and you should have your web application declared as a Servlets 2.3 web app by using the Servlers 2.3 DOCTYPE.

I believe the following is correct for my 2.4 installation:

<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

...

</web-app>
 
Amandeep Singh
Ranch Hand
Posts: 850
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Brown,

I am using this as

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

Is this right to use...
 
Anand Bhatt
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is already discussed here. In FAQ
 
Sumit Jindal
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Dee. I was also having same problem (scripting-invalid not working in DD).
I replaced my web-app spec in DD with yours, and now, scriptlets are disabled.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic