And what makes you think so?? When you press the click here link on input.jsp, a new request is sent to the server to access output.jsp. So the Book bean set in the request to input.jsp, is not available. Remember, each time you request something from the server, a new request is sent...
The trick here is in <jsp:usebean > tag which creates the object as an attribute in the mentioned scope. In this case <jsp:setProperty > is the counter part of request.setAttribute (if the scope is selected as request).
As you might be aware that all the request attributes set in a jsp remain in the same jsp and are lost as soon as the request object available in that jsp is lost. You can refer the following section in useBean syntax
request - You can use the Bean from any JSP page processing the same request, until a JSP page sends a response to the client or forwards the request to another file. You can use the request object to access the Bean, for example, request.getAttribute(beanInstanceName).
If you want the attribute to be available in another jsp as well you shall have to save the object in session. like in following secion
posted 10 years ago
Thanks Ankit and Salil!!!
Your mother was a hamster and your father was a tiny ad:
Devious Experiments for a Truly Passive Greenhouse!