aspose file tools
The moose likes Servlets and the fly likes How to use the bean Object Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "How to use the bean Object" Watch "How to use the bean Object" New topic
Author

How to use the bean Object

Goldie Hawn
Greenhorn

Joined: Mar 02, 2001
Posts: 2
Hi,
when I create the bean object using the following code
<jsp:useBean = "book1" scope="session" class="myClass.Books" />
How can I pass this object book1 as an hidden type request parameter to another html page.
Is this the right way to do it?
<input type=hidden name="book" vaue=book1>
Thanks in Advance
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
The naming policy States : "Do not use the names of celebrities."
Please reregister with a nmae that meets http://www.javaranch.com/name.jsp

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Bharatesh H Kakamari
Ranch Hand

Joined: Nov 09, 2000
Posts: 198
If the HTML page is being called by the same page where the bean instance (<jsp:useBean> action is defined then there is no need to pass it as hidden field as you have already given a "session" scope.
Also note that the syntax should be:
<jsp:useBean id="book1" scope="session" class="myClass.Books" />
HTH
ken chou
Ranch Hand

Joined: Feb 08, 2001
Posts: 68

<jsp:useBean id="book1" scope="session" class="myClass.Books" />
For the above, you define the bean "book1" with the scope of "session", you can always get the same bean as long as it's in any page with the same session. For the following:
<input type=hidden name="book" vaue=book1>

You define a hidden Variable named "book" with a String value "book1". It will be totally different thing since it's not a bean.

hemang patel
Greenhorn

Joined: Mar 06, 2001
Posts: 8
try changing the scope of the bean to application. Then, you can use the same bean in the html if that html is a part of the application ....
 
 
subject: How to use the bean Object
 
Threads others viewed
Get values from the jsp
returning user defined objects
Using Session Bean Info in a server
NameSpaces in XML
datasource using tomcat in spring
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture