Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Interview-Questions how can we use beans in jsp
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Nagendran
how can we use beans in jsp
2 Answer(s)      2 years and 7 months ago
Posted in : JSP-Interview Questions


how can we use beans in jsp


Advertisement
View Answers

May 7, 2012 at 4:56 PM


JSP provides three tags to work with beans:-

<jsp:useBean id="bean name" class"bean class" scope = "page | request | session|application "/>

Bean name = the name that refers to the bean.Bean class = name of the java class that defines the bean.

<jsp:setProperty name = "id" property = "someProperty" value = "someValue" / >

id = the name of the bean as specified in the useBean tag.property = name of the property to be passed to the bean.value = value of that particular property .

<jsp:getProperty name = "id" property = "someProperty" />

Here the property is the name of the property whose value is to be obtained from thebean.Below is a code snippet which shows how MyUserClass is used and the valuesaccessed.

For more information, visit the following link:

http://www.roseindia.net/jsp/simple-jsp-example/UseBean.shtml

 <jsp:useBean id="user" class="MyUserClass" scope="session"/>
<HTML>
<BODY>You entered<BR> Name: <%= user.getUsername() %>
<BR>Email: <%= user.getEmail() %><BR>
</BODY>
</HTML>


May 7, 2012 at 4:57 PM


JSP provides three tags to work with beans:-

<jsp:useBean id="bean name" class"bean class" scope = "page | request | session|application "/>

Bean name = the name that refers to the bean.Bean class = name of the java class that defines the bean.

<jsp:setProperty name = "id" property = "someProperty" value = "someValue" / >

id = the name of the bean as specified in the useBean tag.property = name of the property to be passed to the bean.value = value of that particular property .

<jsp:getProperty name = "id" property = "someProperty" />

Here the property is the name of the property whose value is to be obtained from thebean.Below is a code snippet which shows how MyUserClass is used and the valuesaccessed.

 <jsp:useBean id="user" class="MyUserClass" scope="session"/>
<HTML>
<BODY>You entered<BR> Name: <%= user.getUsername() %>
<BR>Email: <%= user.getEmail() %><BR>
</BODY>
</HTML>

For more information, visit the following link:

http://www.roseindia.net/jsp/simple-jsp-example/UseBean.shtml



Related Tutorials/Questions & Answers:
How to use Java Beans in JSP?
How to use Java Beans in JSP?  Hi, I have developed a employee bean...; ..... } Please tell me how I can use Employee Java bean in JSP page? Thanks   Hi, Read at Java Bean in JSP. Thanks   hi dude your qus
can we use class in jsp which implements interface
can we use class in jsp which implements interface   can we use class in jsp which implements interface
Advertisements
how can we pass parameters from jsp href to another servlet
how can we pass parameters from jsp href to another servlet  how can we pass parameters from jsp href to another servlet
can we use include files in struts.....? - Struts
can we use include files in struts.....?  hi, i have a doubt that whether we should not redirect from one jsp to another jsp directly using include r jsp:include directives. I heard that it is violation of struts rules if we
How can we destroy the cookie?
How can we destroy the cookie?   How can we destroy the cookie
Can we use Jmeter for testing a PHP website???
Can we use Jmeter for testing a PHP website???  Can we test a website in PHP using Apache jmeter? Actually, I want to perform load testing of my PHP website. So, whether it will be useful or should I go with any other? Plz
can we write a method in JSP - JSP-Servlet
that second jsp file to avoid code rewriting. how can I do this please help me out...can we write a method in JSP  Hi All, In my web application I want to call another second jsp file. I can do it by redirecting my first jsp file
How to display data in jsp from dao using java beans?
How to display data in jsp from dao using java beans?  Hi I need to display data in jsp pulling from dao using java beans, Please can anyone give me the sample application with above topics. Any help would be highly appreciated
how can we store the encrypted passwaord in swings?
how can we store the encrypted passwaord in swings?   how can we store the encrypted passwaord in swings
How we can create a table through procedure ?
How we can create a table through procedure ?  How we can create a table through procedure
How can we know that a session is started or not?
How can we know that a session is started or not?  How can we know that a session is started
How can we repair a MySQL table?
How can we repair a MySQL table?  How can we repair a MySQL table
How can we register the variables into a session?
How can we register the variables into a session?  How can we register the variables into a session
Using image in WML We can use the
this lesson we will write application that images. We can use..., in that case we can use the alt property of <img>
How can we get hibernate statistics?
How can we get hibernate statistics?  Hi, How can we get hibernate statistics? Thanks,   Hi, The Hibernate statistics is one of the most usable feature of Hibernate, having some hidden concepts, is the power
how we can create website through java
how we can create website through java  Dear actually i wanna ask query about creation of website through java then how we can create web site through java plz help me..........i have already a web site ....specially for premium
How can we destroy the session, how can we unset the variable of a session?
How can we destroy the session, how can we unset the variable of a session?  How can we destroy the session, how can we unset the variable of a session
java beans code in jsp - WebSevices
java beans code in jsp  can you tell me how to use java beans in jsp in step wise. iam doing online banking project. i need java beans code connecting jsp page to mysql database. please send me the code for login page, myaccount
Implementing Bean with scriptlet in JSP
page We can use all of the JSP coding while using Java Beans in a JSP page... a single expression then you can use JSP scriptlets in the following way : ...;if-else" in your JSP page you can use it like this: <% 
How can we save a data list in jsf?
How can we save a data list in jsf?  I have a code in jsf that fires a query in Data Base each time it is called, i have added a validation check to fire query only if list is not-empty but the list gets empty each time
how can i use one dbase conection in serveral pages - JSP-Servlet
how can i use one dbase conection in serveral pages  Hi! Thanks for sending code... But my actual requirement is In my project i am writing dbase connections many times whereever i need in several pages. How can I avoid
How can i Change Button Label Value Randomly in VIRTUAL KEYBOARD using JAVA or Net Beans ???
How can i Change Button Label Value Randomly in VIRTUAL KEYBOARD using JAVA or Net Beans ???  How can change Button Label value Every Time when... not possible in Java otherwise in VB or NetBeans solu Sothat i can use only Method
How can i Change Button Label Value Randomly in VIRTUAL KEYBOARD using JAVA or Net Beans ???
How can i Change Button Label Value Randomly in VIRTUAL KEYBOARD using JAVA or Net Beans ???  How can change Button Label value Every Time when... not possible in Java otherwise in VB or NetBeans solu Sothat i can use only Method
How can i use Facebook connect button
How can i use Facebook connect button  Please to meet you all guys I wonder how can i use this Connect to facebook for me to post in a particular... http://likekhevy4.blogspot.com/ How can i apply this kind of comment with "Connect
jsp,beans,jdbc - JSP-Servlet
database for specific date .this data is retrived on jsp page by beans.i use beans...jsp,beans,jdbc  I have created jsp page and corresponding servlet... in jsp how to show field sum on jsp page plz guide   Hi friend
how to use image tag in jsp
how to use image tag in jsp  How to use image tag in JSP
how can manages records in jsp
how can manages records in jsp  how can sho only five record at a time and next 5 on click next button and so on in jsp
how to generate PDF file using JSP with net beans
how to generate PDF file using JSP with net beans  I am trying to generate PDF file using JSP. I even added itext5.0.6 jar file in library. It shows...\apache\jsp\hh_jsp.java:8: package com.lowagie.text does not exist import
Web Service - Which files we have to give to client and how they will use that
and have to use it, how we call this in jsp/servlet 3) Which type of response we...Web Service - Which files we have to give to client and how they will use.... 2) In client side how they will use that, and how they call method from
what is cloud computing? any how we can implement?
what is cloud computing? any how we can implement?  what is cloud computing? any how we can implement
How can we submit a form without a submit button?
How can we submit a form without a submit button?  How can we submit a form without a submit button
Advertisements
 

 

 

DMCA.com