• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question from JDiscuss.

 
Pabak Nanda
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • 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)?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic