thanks to every body who responded ----- Original Message ----- From: DAVE TOWNSEND <[EMAIL PROTECTED]> To: 'Evan Chua-Yap' <[EMAIL PROTECTED]> Sent: Thursday, September 02, 1999 8:11 AM Subject: RE: hellouser variation: is it possible?? > Just to check, I am assuming that you have taken one JSP and split it into > two? Thats what it looks like anyway. Heres a quick idea of what is going on > here. > > Your first JSP needs no beans or anything, doesn't even need to be a jsp > page, html will do fine. When the form is filled out, the information is > sent in the request to the second page. It is in the second page that you > can choose to have a bean (see why I say choose later). I've adapted your > code here: > > getName.jsp (or .html) > > <html> > <body> > <form method=get action=showName.jsp> > Your Name: <input type="text" name="username" size=25><br> > <input type="submit" value="Submit"> > <input type="reset" value="Reset"> > </form> > </body> > </html> > > > showName.jsp > > <jsp:useBean id="myNameHandler" scope="session" class="myForm.NameHandler"/> > <jsp:setProperty name="myNameHandler" property="*"/> > <html> > <body> > Hello, <jsp:getProperty name="myNameHandler" property="username" />! > </body> > </html> > > That should work for you. The trick is understanding the second line of > the second file. When you use the <jsp:setProperty> like that, it attempts > to fill out the myNameHandler fields with information from the request > header. Here you have one item in the request header - username, so it will > call myNameHandler.setUsername() to set it from whatever the user entered. > > There is another alternative, where you don't even need beans, although > this becomes pointless if you want to use the info in multiple pages: > > showName2.jsp > > <html> > <body> > Hello, <%= request.getParameter("username") %>! > </body> > </html> > > This simply pulls the info out of the request. > > > Hope some of this helps. > > Dave > > -----Original Message----- > From: Evan Chua-Yap [mailto:[EMAIL PROTECTED]] > Sent: 01 September 1999 18:14 > To: [EMAIL PROTECTED] > Subject: hellouser variation: is it possible?? > > > hi all! > i just downloaded the early JSP Tutorial chapters. In the chapter > for handling forms, the hellouser example uses an include directive > to show the submitted name. > > i was wondering: is it possible to specify a 'submit' action that goes > to a different .jsp page, and show the submitted name on that page?? > > here's what i have right now, but i get a Cannot Compile error for show.jsp > > is there a way to get it to work? > (Note: adding <jsp:useBean id="myNameHandler" scope="session" > class="myForm.NameHandler"/> > right before i do the getProperty doesnt help) > > getName.jsp > -------------------- > > <html> > > <body> > > <jsp:useBean id="myNameHandler" scope="session" class="myForm.NameHandler"/> > > <jsp:setProperty name="myNameHandler" property="*"/> > > <form method=get action=showName.jsp> > > Your Name: <input type="text" name="username" size=25><br> > > <input type="submit" value="Submit"> > > <input type="reset" value="Reset"> > > </form> > > </body> > > </html> > > > > > > showName.jsp > > ------------ > > <html> > > <body> > > Hello, <jsp:getProperty name="myNameHandler" property="username" />! > > </body> > > </html> > > > =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". FAQs on JSP can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html