File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Scripting Invalid

 
Amruth Puppala
Ranch Hand
Posts: 295
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the output of the following code
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you think the output could be ?
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Christophe Verre:
What do you think the output could be ?


Hi Verre,

i tried This, surprise! i am getting output.

i able to use scripting(<%%> in main/page1.jsp.

please anyone can explain me
[ August 12, 2008: Message edited by: seetharaman venkatasamy ]
 
Amruth Puppala
Ranch Hand
Posts: 295
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As per my view output should be
<% int i=12; %>
<%= i %>

[ August 12, 2008: Message edited by: Chintu sirivennela ]
 
deepa raj
Ranch Hand
Posts: 124
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I go with chintu's Answer.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi chintu and deepa,

i tried but i did not get your answare...i can not invalid the scripting... where i am wrong?...any idea please
 
deepa raj
Ranch Hand
Posts: 124
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
while accessing the page ,

Exception was thrown.

org.apache.jasper.JasperException: /test.jsp(1,4) Scripting elements ( <%!, <jsp eclaration, <%=, <jsp:expression, <%, <jsp:scriptlet ) are disallowed here.


:-(
 
deepa raj
Ranch Hand
Posts: 124
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi seetharaman,

/main/page1.jsp may reside somewhere else.

It should be <context-root>/main/page1.jsp


If you are enabling the scripting-invalid , it will give runtime exception.
[ August 12, 2008: Message edited by: deepa raj ]
 
Amruth Puppala
Ranch Hand
Posts: 295
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Deepa raj, Why that got exception..So our expectation is wrong.
So what would be the reason can some one answer this.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chintu sirivennela:
..So our expectation is wrong.


No. you are correct according to the <scripting-invalid>... but here i am struggling to implement it in web.xml...the jsp is not understanding here...thats my problem,,,

but answare should be your expectation
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by deepa raj:
hi seetharaman,

/main/page1.jsp may reside somewhere else.

It should be <context-root>/WEB-INF/main.page1.jsp


If you are enabling the scripting-invalid , it will give runtime exception.


is it necessary to my jsp should inside WEB-INF?
 
deepa raj
Ranch Hand
Posts: 124
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mistakenly i have put WEB-INF.

it should be <context-root>/main/page1.jsp
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to JSP.3.3.3 Disabling Scripting Elements, setting scripting-invalid to true results in a Translation Error when scripting is encountered.
 
Amruth Puppala
Ranch Hand
Posts: 295
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank so much Christophe Verre,

I thought if we disable scripting , the container is treated scripting as normal text. My understanding was wrong.

Once again thanks for your help here in this forum(I got lot of clarifications and help from you).
 
Sandeep Bhandari
Ranch Hand
Posts: 201
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well guess what will be the output if el-igonred is true in Deployment Descriptor and the container/compiler encounters some Expression Language (sort of $())
 
Amandeep Singh
Ranch Hand
Posts: 850
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you use the tag <el-ignored>, then the output will be as it is in the output. The container will not compalin about it.
 
Amruth Puppala
Ranch Hand
Posts: 295
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SO finally
1. If <el-ignored> true, if JSP contains any EL code it ignores to execute as EL, container treat that as normal text and displays normal text
2. <scripting-invalid> true, then if container encounters any scripting code it will throw Translation Error

Correct me If I am wrong.
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's correct.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yesterday i tried in GlassFish server..thats why i confused. you will get different output in that server
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried using Glassfish :
org.apache.jasper.JasperException: /test.jsp(2,2) PWC6203: Scripting elements ( <%!, <jsp:declaration, <%=, <jsp:expression, <%, <jsp:scriptlet ) are disallowed here.

Here is my web.xml :


Check yours. Maybe you'll need to clear some cache ?? (I didn't).
[ August 12, 2008: Message edited by: Christophe Verre ]
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes . Verre you are correct. today i got what you said. but yesterday in my JSP,scripting-invalid not working only!!!

i do not know the problem

Thanks Verre.
 
Sandeep Bhandari
Ranch Hand
Posts: 201
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An easier way to remember the outcome in both cases is as:

el-ignored -- ignored means that what you considered code will now be template text
scripting-invalid -- the code which you thought to be a scriptlet will cause an exception because it is invalid



Thus focus on the two words:
ignored
invalid
 
Amruth Puppala
Ranch Hand
Posts: 295
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great understanding Sandeep Bhandari
 
prashant modak
Greenhorn
Posts: 14
Java Linux Redhat
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
still showing inconsistent behavior.
can not rely on <jsp-config>
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic