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



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

Have Programming Question? Ask it here!
 
 
 


Nagendran
how can we use beans in jsp
2 Answer(s)      2 years and 3 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 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 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 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
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
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 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
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 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
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 use image tag in jsp
how to use image tag in jsp  How to use image tag 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
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 know the count/number of elements of an array?
How can we know the count/number of elements of an array?  How can we know the count/number of elements of an array
how can we prevent back option after log out.
how can we prevent back option after log out.  how can we prevent back option after log out
How can we increase the execution time of a php script?
How can we increase the execution time of a php script?  How can we increase the execution time of a php script
How can we create a database using PHP and mysql?
How can we create a database using PHP and mysql?  How can we create a database using PHP and mysql
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
How many ways we can give the output to a browser?
How many ways we can give the output to a browser?  How many ways we can give the output to a browser
How can we encrypt the username and password using PHP?
How can we encrypt the username and password using PHP?  How can we encrypt the username and password using PHP
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
How many cookie object we can store in a session? is there any limit?
How many cookie object we can store in a session? is there any limit?  How many cookie object we can store in a session? is there any limit
How can we find the number of rows in a result set using PHP?
How can we find the number of rows in a result set using PHP?   How can we find the number of rows in a result set using PHP
How can we get second of the current time using date function?
How can we get second of the current time using date function?  How can we get second of the current time using date function
How many ways can we get the value of current session id?
How many ways can we get the value of current session id?  How many ways can we get the value of current session id
how to use sendRedirect in doGet method in jsp?
how to use sendRedirect in doGet method in jsp?  i am getting problem in jsp that when we are directly writing address to a jsp page in addressbar the jsp page should redirect it to the html page.   can any one tell me
How to access Enterprise Beans
a no-interface view. How to use Enterprise Beans in clients To know before the use... of these Enterprise Beans in clients can be use/get by either the dependency injection...How to access Enterprise Beans In this tutorial you will learn that how
How to use Jquery in jsp page
How to use Jquery in jsp page  Hello Sir, I am... in my jsp page. I have heard that jquery will be usefull for this work.... 3.Edit 4.Delete. plz sir Guide me how to complete the above task. Thank you
how can manages recordset in jsp
how can manages recordset in jsp  I am ask a question how can show 5-5 records in jsp page and I get answer provided by you but it give exception:- org.apache.jasper.JasperException: /jsp/paging.jsp(75,0) According to TLD
how to use a placeholders - JSP-Servlet
how to use a placeholders  dear sir, how to use... be fetch ,so how to use a place holder for this [column ] and also how to get... can catch that... Thanks Harini
How can we implement Pop-up in JQuery without Plugin?
How can we implement Pop-up in JQuery without Plugin?  Hi Sir How can we Implement pop-up in JQuery without using plug-in. Please provide me code... one png image for pop box. Here we are using "bubble.png" as background image
Can anybody tell me how to use #parameters in struts 2 ?
Can anybody tell me how to use #parameters in struts 2 ?  I have a login page, And by using struts.xml and #parameters I want to display error message if there is any error in login. Ex : struts.xml welcomePage.tiles /jsp
What is the maximum size of a file that can be uploaded using PHP and how can we change this?
What is the maximum size of a file that can be uploaded using PHP and how can we change this?  What is the maximum size of a file that can be uploaded using PHP and how can we change
How to use for loop in jsp
How to use 'for' loop in jsp page ? This is detailed java code that shows how to use 'for' loop in jsp page. 'if' statement is used to test conditions while... for the loop. In this example, we have developed use_for_loop.jsp page which shows
Advertisements
 

 

 

DMCA.com