• Post Reply Bookmark Topic Watch Topic
  • New Topic

org.apache.jasper.JasperException error  RSS feed

 
Basil Smart
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I keep getting this error below, jsp code works on my PC but on server I get error, all I'm doing is changing the date format from eg. 01-12-2017 to 2017-01-27.

I have changed code multiple times previously using enhanced for loop and still getting same error on server, yet it works on my PC perfectly. Any help is greatly appreciated, thanks.



her is the actual code that is producing error now below:

 
Nguyen Tuyen
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's try to debug your program to see what truely happen. I just giving some guest here:
This line can make outputDate an array with 2 or more value if editionDate exits the "-", but if "-" is not exist then outputDate will be empty.
That's why outputDate[2] can throw an IndexOutOfBoundException. ==> Try to check here before using it

The reason I thought is in your computer the date using pattern with "-" to split date-month-year, but the server using pattern: "/" to split date/month/year
 
Dave Tolls
Ranch Foreman
Posts: 3001
37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first thing that leaps out to me is that you have Java code in your JSP page.
This is not a Good Thing.

However, I expect that might be how you're being taught?
 
Basil Smart
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys, thanks for your reply.

Nguyen, I get this output when I print array indexes below from my PC:



Dave, I agree but if code works on PC , it should also work on server unless java library used on PC is missing on server, but libraries are in both PC and server.

Any other suggestions, thanks?



 
Nguyen Tuyen
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basil Smart wrote:Hi Guys, thanks for your reply.

Nguyen, I get this output when I print array indexes below from my PC:



Dave, I agree but if code works on PC , it should also work on server unless java library used on PC is missing on server, but libraries are in both PC and server.

Any other suggestions, thanks?





You got problem when using on server and it's works on your machine, so why did you make a simple test on your PC? Your test is meaningless! The thing you need to check is print out value of the editionDate when running on server!
 
Dave Tolls
Ranch Foreman
Posts: 3001
37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My suggestion is move that code out of the JSP page.
That will make it a lot easier to test, and debug.
 
Basil Smart
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Guys for your reply, not sure why code would work on PD but not on server when all the relevant libraries are included. Anyway I decided not to use the array, instead I used simple regex as solution below:



I'll move the java code out of the jsp section shortly.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!