GeeCON Prague 2014*
The moose likes JSP and the fly likes Jsp Exception Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "Jsp Exception Error" Watch "Jsp Exception Error" New topic
Author

Jsp Exception Error

mike krony
Greenhorn

Joined: Apr 15, 2012
Posts: 5
i get an error "org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 18" i think my exception code is wrong. i don't know how to return an empty string when the user doesn't enter any number and clicks "continue". any suggestions

Piyush Mangal
Ranch Hand

Joined: Jan 22, 2007
Posts: 196

How are you making sure that request.getParameter("number") always has valid integer string ? You are just checking for null values. The value could also be empty or non integer string.
mike krony
Greenhorn

Joined: Apr 15, 2012
Posts: 5
should i set request.getParameter("number")="";
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61315
    
  66

First of all, backing up a bit: is this a legacy page? As in over 10 years old? If not, why are you using ancient technology (Java scriptlets) on your JSP?

If this is not a legacy page, your JSP knowledge is very dated and needs some updating.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
mike krony
Greenhorn

Joined: Apr 15, 2012
Posts: 5
i am new to jsp Bear Bibeault, and i am stuck on this for couple of days. i didn't know its an old technology
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61315
    
  66

OK, just to bring you up to date. Putting Java code in a JSP is an old practice from JSP 1 days before 2002. Continuing to put Java into JSP pages is now considered a poor practice.

As of 10 years ago, with the introduction of JSP 2, the JSTL (JSP Standard Tag Library) and the EL (Expression Language) are the accepted means to make JSP pages dynamic.

I would suggest finding yourself a modern tutorial to work from that focuses on JSTL and EL rather than Java scriptlets. The latter isn't a bad skill to know about in case you end up supporting legacy pages, but new pages should never use scriptlets.

I recommend that all newcomers read the following articles:
  • The Secret Life of JSPs
  • The Front Man

  •  
    GeeCON Prague 2014
     
    subject: Jsp Exception Error