File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Scripting-Invalid(Usage) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Scripting-Invalid(Usage)" Watch "Scripting-Invalid(Usage)" New topic
Author

Scripting-Invalid(Usage)

Sudhakar Guntaka
Ranch Hand

Joined: Nov 21, 2004
Posts: 46
Hi,
I am trying to disable all the scripting elements in a JSP page by using "<scripting-invalid>" tag in DD. Even though I unable to disable scripting elements.
They(scripting elements) are being processed by JSP and I am able to see the result of Scripting elements. But it should not happen. We must see scripting code without prcessing. Right!!!
Please help me to sortout this issue.......

cheers,
Sudhakar.
Sami Sayeed
Ranch Hand

Joined: Oct 05, 2004
Posts: 39
Hi,
make sure you are using tomcat 5.1

<jsp-config>

<jsp-property-group>
<description>
Special property group for JSP Configuration JSP example.
</description>
<display-name>JSPConfiguration</display-name>
<url-pattern>*.jsp</url-pattern>
<scripting-invalid>true</scripting-invalid>


</jsp-property-group>
</jsp-config>

try this out..
cheers
Sami
Sudhakar Guntaka
Ranch Hand

Joined: Nov 21, 2004
Posts: 46
Hi Sami,
I am using Tomcat 5.0.28. I did like this.

(first.jsp)

<%out.print("This is text in JSP");%>
<%out.print("This is another text in JSP");%>
Value: <%=9%>


(web.xml)

<web-app>
<servlet>
<servlet-name>hello</servlet-name>
<jsp-file>/first.jsp</jsp-file>
</servlet>

<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>

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

</web-app>

and I invoked the JSP page. I am getting

This is text in JSP This is another text in JSP 9

but I should not get like this. Right !!! Where I am going wrong??

cheers,
Sudhakar.
Sami Sayeed
Ranch Hand

Joined: Oct 05, 2004
Posts: 39
Hi Sudhakar,

try this out.

1. make some changes in your jsp, like add a space or whatever..
2. now try giving a request.
I tried it at my end and seems to work fine.

cheers
Sami
Abhishek Mahanty
Greenhorn

Joined: Jan 26, 2004
Posts: 19
Originally posted by sudhakar:
Hi,
... I am able to see the result of Scripting elements. But it should not happen. We must see scripting code without prcessing. Right!!!


Hi, if you disable scripting in web.xml i.e.

<scripting-invalid>true</scripting-invalid>

Then you should get a Translation Error if the jsp engine encounters any scripting element in your JSP page. So you don't get to see any "scripting code without processing". (Refer JSP 2.0 specs Table JSP.3-3)

BUT the EL ignored setting behaves differently i.e. if we have

<el-ignored>true</el-ignored>

Then we get to see the EL expressions in their unevaluated form (NO Translation Error in this case).

Abhi.


SCEA-I, SCBCD 1.3, SCWCD 1.4, SCJP 1.4, OCP
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Scripting-Invalid(Usage)