• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why does this jsp throw so many errors ?  RSS feed

 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I get following result, when I run this code.

links.jsp:5:2: 'try' statement has neither 'catch' nor 'finally' clause
String cmsNodePath = (String) pageContext.getAttribute("cmsNodePath",PageContext.REQUEST_SCOPE);
^----------------------------------------------------------------------------------------------^
links.jsp:8:2: This expression can throw an exception javax.servlet.jsp.JspException that is not caught by any enclosing try statement and is not allowed in this method, constructor, or initializer block.
<content:getNode id="cmsNode" path="<%=cmsNodePath %>"/>
^-------------^
links.jsp:8:2: This expression can throw an exception javax.servlet.jsp.JspTagException that is not caught by any enclosing try statement and is not allowed in this method, constructor, or initializer block.
<content:getNode id="cmsNode" path="<%=cmsNodePath %>"/>
^-------------^
links.jsp:8:57: This expression can throw an exception javax.servlet.jsp.JspException that is not caught by any enclosing try statement and is not allowed in this method, constructor, or initializer block.
<content:getNode id="cmsNode" path="<%=cmsNodePath %>"/>
^
links.jsp:17:7: This expression can throw an exception javax.servlet.jsp.JspException that is not caught by any enclosing try statement and is not allowed in this method, constructor, or initializer block.
<content:getProperty name="<%=links_label%>" node="<%=cmsNode%>" resultId="label" />
^-----------------^
links.jsp:17:7: This expression can throw an exception javax.servlet.jsp.JspTagException that is not caught by any enclosing try statement and is not allowed in this method, constructor, or initializer block.
<content:getProperty name="<%=links_label%>" node="<%=cmsNode%>" resultId="label" />
^-----------------^
links.jsp:17:90: This expression can throw an exception javax.servlet.jsp.JspException that is not caught by any enclosing try statement and is not allowed in this method, constructor, or initializer block.
<content:getProperty name="<%=links_label%>" node="<%=cmsNode%>" resultId="label" />
^
links.jsp:18:7: This expression can throw an exception javax.servlet.jsp.JspException that is not caught by any enclosing try statement and is not allowed in this method, constructor, or initializer block.
<content:getProperty name="<%=links_url%>" node="<%=cmsNode%>" resultId="url" />
^-----------------^
links.jsp:18:7: This expression can throw an exception javax.servlet.jsp.JspTagException that is not caught by any enclosing try statement and is not allowed in this method, constructor, or initializer block.
<content:getProperty name="<%=links_url%>" node="<%=cmsNode%>" resultId="url" />
^-----------------^
links.jsp:18:86: This expression can throw an exception javax.servlet.jsp.JspException that is not caught by any enclosing try statement and is not allowed in this method, constructor, or initializer block.
<content:getProperty name="<%=links_url%>" node="<%=cmsNode%>" resultId="url" />
^
links.jsp:25:1: Expression expected (found 'catch' instead)
</ul>
^----
</div>
-----^
links.jsp:25:1: Illegal use of an expression as a statement.
</ul>
^----
</div>
-----^
links.jsp:25:1: No variable or field with this name could be found at this location.
</ul>
^----
</div>
-----^
links.jsp:25:1: No variable or field with this name could be found at this location.
</ul>
^----
</div>
-----^
links.jsp:25:1: Syntax error: expected ) (found '__ee' instead)
</ul>
^----
</div>
-----^
links.jsp:25:1: Illegal use of an expression as a statement.
</ul>
^----
</div>
-----^
links.jsp:25:1: Syntax error: expected ; (found ')' instead)
</ul>
^----
</div>
-----^
links.jsp:25:1: No variable or field with this name could be found at this location.
</ul>
^----
</div>
-----^
links.jsp:25:1: No variable or field with this name could be found at this location.
</ul>
^----
</div>
-----^
links.jsp:25:1: Syntax error: expected } (found 'EOF' instead)
</ul>
^----
</div>
-----^


I can not figure out whats wrong with this code.

 
Kumar Kamlesh
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nirjari,

The syntax of the JSP seems to be fine. You may debug more into the tag libraries and the tag handler classes being used in this JSP.

- Kamlesh
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At the very least, you're missing a closing "}". Some of the errors may go away once you add that.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!