The difference between <b>failure</b> and <b>success</b> is often being <b>right</b> and being <b>exactly right</b>.
[My Blog]
All roads lead to JavaRanch
Originally posted by Satou kurinosuke:
I don't understand why you create the bean from the first page. If you populate it in a servlet, you could create it in the servlet, put it request scope, forward to the JSP page and retrieve it from request scope. If you use it only for this JSP, then I think it would be better to put it in request scope, rather than session scope.
The difference between <b>failure</b> and <b>success</b> is often being <b>right</b> and being <b>exactly right</b>.
Ok, suppose i want to populate in servlet, how can i declare a bean in a servlet with SPECIFIED scope?
[My Blog]
All roads lead to JavaRanch
Originally posted by Satou kurinosuke:
Calling setAttribute() on either request(passed as a parameter to your servlet), or session (using getSession()), or application (using getServletContext())
The difference between <b>failure</b> and <b>success</b> is often being <b>right</b> and being <b>exactly right</b>.
Originally posted by Muhammad Ali Amin:
what does "scope="request"" means.
Originally posted by Ben Souther:
It means that the JSP will look for an instance of your object in request scope. If it doesn't find it there, it will instanciate on itself (providing you've set a class attribute) and bind it to reqest scope.
Looking at the generated servlet source will reveal all of this.
The difference between <b>failure</b> and <b>success</b> is often being <b>right</b> and being <b>exactly right</b>.
[My Blog]
All roads lead to JavaRanch
Originally posted by Muhammad Ali Amin:
Now want to clear one more thing. JSP saves the object in request, servlet get it by calling getAttribute(), process/populate it and then ... will it automatically save it again in request/response attribute or i have to do it explicitly? to make the object available in next called JSP?
Bosun (SCJP, SCWCD).
So much trouble in the world -- Bob Marley
The difference between <b>failure</b> and <b>success</b> is often being <b>right</b> and being <b>exactly right</b>.
Originally posted by Muhammad Ali Amin:
so you mean that i can access the same object in servlet by call getAttribute() method of servlet?
There is no greater crime than stealing somebody's best friend. I miss you tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|