<html><body>
<% Integer count = (Integer) request.getSession(false).getAttribute("count");
if(count != null )
{
out.println(count);
}
else
request.getSession(true).setAttribute("count", new Integer(1));%>
Hello!
</body></html>
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.
<listener>
<listener-class>Fully qualified Class Name </listener-class>
</listener>