Hi, I can create a Person (with a Name) in the Init.init method and then get the text onto the response jsp page. And I assume this was what the homework was all about.
But, I would like to take the name from the index.jsp page. Is this possible? Yes, of course... but how? I changed index.jsp to submit both firstName and lastName, OK I changed response.jsp to use a new bean: <jsp:useBean id="mybean2" scope="session" class="mypackage.Name" /> <jsp:setProperty name="mybean2" property="*" /> Hello, <jsp:getProperty name="mybean2" property="name" /> OK, that works too. But how do I access the Name object bound to mybean2 when I need a name for my new Person object in Init? I've tried the obvious: //Name n = (Name) sce.getServletContext().getAttribute ("mybean2"); //System.out.println("Name: " + n); Some suggestions? Or is the problem simply that the init method is run before the bean is created? My "solution" is to create yet another bean on response.jsp: <jsp:useBean id="mybean3" scope="session" class="mypackage.Person" /> <jsp:setProperty name="mybean3" property="name" value="<%= mybean2 %>" /> which I then can access on the response page <c:out value="${mybean3.name.firstName}"/> Some suggestions for a more elegant solution? Is my example simply lacking some kind of controller servlet? /Fredrik --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en -~----------~----~----~----~------~----~------~--~---