The 'name' comes from the accessor methods your controller has. In your example lets say that your 'obj' has a method called getFirstName() Now if you want to display the persons first name you simple have a call like this in your JSP
<c:out value="${model.object1.firstName}"/>
AND your controller, whichever one is associated with this JSP has an accessor method like this
public Object1Type getObject1() { return (Object1Type)this.getCtx().getRequest().getSession().getAttribute("object1"); }
-----Original Message----- From: Ed Thompson [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 30, 2003 3:15 PM To: [EMAIL PROTECTED] Subject: [Mav-user] Getting to an object from JSP
OK I think I have the model thing figured out, alotgh I am not sure how my JSP knows what kind of object the model is representing (how does it know there is an attribute called 'name' for instance?)
Now, my 'controller' creates an object that I want to have session scope, and be able to access it from my JSP page when some other object is the model.
So, I saved it by using: this.getCtx().getRequest().getSession().seAttribute("object1", obj);
Now I want to get to it from a JSP(similiar to useBean) and call one of its methods.
How do I do it? Is the setAttribute approach the 'right' way to start?
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf [INVALID FOOTER]
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf [INVALID FOOTER]
So basically everything the jsp needs should ge accessible with a getter method in the current controller object? (Trying to understand the theory).
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf [INVALID FOOTER]