File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes <jsp:setProperty> is raising Exceptions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "<jsp:setProperty> is raising Exceptions" Watch "<jsp:setProperty> is raising Exceptions" New topic

<jsp:setProperty> is raising Exceptions

Graeme Byers
Ranch Hand

Joined: Apr 16, 2004
Posts: 127
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

Joined: Jan 10, 2002
Posts: 63844

  • 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.

  • [Asking smart questions] [About Bear] [Books by Bear]
    I agree. Here's the link:
    subject: <jsp:setProperty> is raising Exceptions
    jQuery in Action, 3rd edition