File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes How to setProperty of nested properties? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to setProperty of nested properties?" Watch "How to setProperty of nested properties?" New topic
Author

How to setProperty of nested properties?

Alex Pi
Greenhorn

Joined: Jan 08, 2013
Posts: 17

I've got 2 JavaBean-classes:

Then i retrieve request parameters in JSP:


How can i set properties for person.address (nested property)? (person.firstName & person.secondName are correct).
Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

As you are using the JSTL and EL why are you bothering with useBean and setProperty at all?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Alex Pi
Greenhorn

Joined: Jan 08, 2013
Posts: 17

Bear Bibeault wrote:As you are using the JSTL and EL why are you bothering with useBean and setProperty at all?

You have catched me. :) I learn JSP, and i still didn't know JSTL.
I know how to use scriptlets but i do first steps (only couple days) with EL.

Perhaps it will be better to ask how could i set nested properties without using scriptlets.
Sai Prasad Sabeson
Greenhorn

Joined: Oct 10, 2011
Posts: 4

Using EL you can set the value of the property inside person


This will set all the params there in the request scope to the bean.Your Address property will be null untill now.

Now,

this can set the values to the bean 'person'.Before you set the value adress ,make sure that you have address bean set up

Hope this helps
 
 
subject: How to setProperty of nested properties?
 
Similar Threads
Jasper compile error
One-to-One mapping problem
Dynamically populate java bean tree
HFSJ Question in JSTL
JSF, EJB3 target unreachable, returned null