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

How to setProperty of nested properties?

 
Alex Pi
Greenhorn
Posts: 17
Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As you are using the JSTL and EL why are you bothering with useBean and setProperty at all?
 
Alex Pi
Greenhorn
Posts: 17
Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic