Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

<jsp:setProperty> is raising Exceptions

 
Graeme Byers
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two problems. Thank you for any help.

JavaBean :


Problem 1 :

The following JSP correctly displays 1 = Tom , 2 = Tom 3 = Tom


Uncomment the <jsp:forward> and NextPage.jsp correctly displays 4= Tom , 5 = Tom
but why the JasperException ?


Problem 2 :

Both getSomeValue and getSomeValueEL correctly display X.

But why are the exceptions raised for someKey ?
Why is the standard action and EL aware that it's an int ?
That's a 'private' implementation - I thought that only the names of getter and setter methods mattered.

The real point is : how do you handle a JavaBean when its properties are not String ?
Hans Bergsten's JSP speaks of property editors being used to handle Date (I've not reached Ch 22 yet). Is that the solution ?


 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64632
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
  • Why are you forwarding after emitting content? That's bound to cause problems and should never be done. What's the intent with the forward?


  • If you are writing modern JSP, the setProperty action should be jettisoned in favor of the <c:set> action using the "target" format.


  • I don't know where you picked up that really odd Java code formatting, but it's unlike any convention in popular use and makes your code almost impossible to read. I'd revisit that decision and adopt a more conventional formatting approach.


  •  
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic