This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to setProperty of nested properties?  RSS feed

 
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
Posts: 66142
141
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
Boost this thread!