• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why no translation error when "<scripting-invalid>true</scripting-invalid>" and scripting anyway?

 
Ralf Wahner
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Colleagues

This forum already contains at least two threads concerning my question (namely"scripting-invalid tag" by Richard Rex, Sep. 9th 2005 and "Scripting-Invalid(Usage)" by Sudhakar Guntaka, Nov. 21st 2004), which could not help me out. Allow me to ask again, please.

Given that mypage.jsp is

and web.xml is

The JSP specification claims, that a translation error should occur, if <scripting-invalid>true</scripting-invalid> and scripting is encountered (table JSP.3-3, p. I-89).

Why does mypage.jsp happily translate without error and _jspService() contains

The cache has been cleared and Tomcat 5.5.26 (xmlValidation="true") has been restartet serveral times. The same happens when I substitute /mypage.jsp by *.jsp in the <url-pattern>. What is wrong?

Best regards,

Ralf Wahner
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe because Tomcat does not consider a comment to be a script. The comment has no effect in the resulting class, so I guess Tomcat just forgives it. What happens if you try to put some "real" scripting ?

I don't think it's spec friendly though. If you could try with another web container and see what happens...
 
Ralf Wahner
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Christophe, Dear Colleagues

Thank you for your reply. The same happens for scriptlets and expressions:

Tomcat 5.5.26 and Jetty 6.1.14 transform the JSP code to

with <scripting-invalid>true</scripting-invalid> as before.

Questions:
+ Is my deployment descriptor complete (see above web.xml)?
+ Could I ask you to verify this noticeable erratic behaviour?

Best regards,

Ralf Wahner


Post scriptum: Notes concerning Jetty 6.1.14

+ Deploy web archives (.war files) to directory webapps.
+ Deployed web archives are extracted to /tmp with Linux.
+ Jetty seems to abandon the generated servlet sourcecode by default. Create a new init parameter keepgenerated in etc/webdefault.xml:

+ Point browser to http://localhost:8080/[context]/[appl] as usual.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure that your web.xml is declared properly. Check this.
 
Ralf Wahner
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Christophe

Mission accomplished. :-) Thank you very much for your support, especially for your hint about the <web-app> attributes.
What was wrong? My web.xml was incomplete; the corrected deployment descriptor reads:

Now both, Tomcat 5.5.26 and Jetty 6.1.14, return status 500 and report that "Scripting elements (<%! , <jsp:declaration , <%= , <jsp:expression , <%, <jsp:scriptlet) are disallowed here."

Best regards,

Ralf Wahner
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic