File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes object cascading in a template Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "object cascading in a template" Watch "object cascading in a template" New topic
Author

object cascading in a template

Kalle Brecht
Greenhorn

Joined: Nov 11, 2011
Posts: 5
Hello,

it seemed to be a little and easy question. Unfortunatelly i didn't find anything in the internet and I'm a noob in struts...
Here the Problem:
I give an object (obj1) to the template and I want to access to the id-variable of the object (obj2) within the object (obj1).
I thougt it's possible to things like:



The Action and every object has all getter/setter and I'm able to get the variables of obj1.

I think I only make a misstake how I want to access at the id... I also tried thinks like:


Perhaps, somebody can help me?

Greetz
V
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

Try this <s:property value="%{obj1.obj2.id}"/> This works when you are accessing directly from valueStack.


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
Kalle Brecht
Greenhorn

Joined: Nov 11, 2011
Posts: 5
Hey,

unfortunatelly it wasn't the solution... perhaps i make an other mistake...

i also tried:

the value (%{#aDate.id}) is correct, but when i try to acces at the id of the event, nothing is shown
I have also checked that there is realy an event and I'm sure that the getter/setter in the model of aDate is correct.
I don't know where my mistake is...
Greetz
V
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

Put your project in debug mode and hit the url adding the following ?debug=xml
It will give the valueStack data in xml format. This will confirms that you are getting the data or not. And let me know what you are trying to do exactly in words.
Kalle Brecht
Greenhorn

Joined: Nov 11, 2011
Posts: 5
I'm not sure if this really helps you:


1 false 1 class de.nak.timetable.action.ShowTimetableAction class de.nak.centuryAdministration.model.Century class de.nak.cohortAdministration.model.Cohort 1 9 1 12 cent99 sdasd 9 class de.nak.timetable.model.TimetableDate class de.nak.eventAdmin.model.Event 12 dscr name short Seminar 1 2 2 class java.util.GregorianCalendar 2 class java.util.Date 15 5 1 0 9 0 -12219292800000 -60 -318 true 4 class java.util.Date 11 5 12 12 10 0 1321009920000 -60 111 1321009920000 3600000 Europe/Berlin class sun.util.calendar.ZoneInfo false


I have a list of TimetableDate-models. I iterate this list and want to get the id (for example) of the Event-model which is in every TimetableDate.
I doesn't thought that this is so complicated ^^
Thank's for your help!
Kalle Brecht
Greenhorn

Joined: Nov 11, 2011
Posts: 5
I found a solution!



It seemed to be, that i can't give a name of the variable for the iterator....
Greetz
V
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: object cascading in a template