• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Question from JDiscuss.

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anybody let me know where I am wrong here.



The following element occurs in the deployment descriptor of a web application:

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


What will happen if a JSP file /jsp/hello.jsp contains the following statements:


${param.command}
<%=request.getParameter("command")%>

The options (with explanation from jdiscuss) were

1. It will print the value of the "command" parameter twice.

2. It will print the value of the "command" parameter once and it will print "<%=request.getParameter("command")%>" as it is in the output.

3. It will result in a translation error.
Ex :- If the <scripting-invalid> is specified as true, then a jsp file must not contain any scripting elements otherwise the file is not even translated to the corresponding servlet.

4. It will print the value of the "command" parameter once and the statement "<%=request.getParameter("command")%>" will be ignored.
Ex: Notice the name of the scripting-invalid tag. As opposed to el-ignored it signifies that scripting is to be considerd invalid.




Per my understanding, the answer should be 2 as the container will just not evaluate the scripting. But why this will give error (as per the explanation)?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic