how can we create object to a class in a jsp file?

Answers were Sorted based on User's Feedback



how can we create object to a class in a jsp file?..

Answer / samuel.j

use the page import tag to import ur class and execute
methods of the class

< % @ page import = packageName.Classname %>
<%

ImportedClass object = new ImportedClass();
object.executeMethods();

%>

Please check for some documentation as to including XSLT in
JSP

Is This Answer Correct ?    60 Yes 24 No

how can we create object to a class in a jsp file?..

Answer / upender

you can create with help of useBean tag also.

<jsp:useBean id="beanId' class="packagename.ClassName" />

Is This Answer Correct ?    30 Yes 15 No

how can we create object to a class in a jsp file?..

Answer / ravikiran.chd

inside the declaration tag

Is This Answer Correct ?    12 Yes 7 No

how can we create object to a class in a jsp file?..

Answer / shane rajasinghe

Creating The Object
<% MyBean student=new MyBean(); %>
*************************************************
calling attributes in the created object
<jsp:getStudentInfo name="student" property="name"/>
<jsp:getStudentInfo name="student" property="dit"/>
*****************************************************

Is This Answer Correct ?    7 Yes 11 No

how can we create object to a class in a jsp file?..

Answer / sant kumar

class name = new class name();

Is This Answer Correct ?    9 Yes 18 No

Post New Answer

More Servlets Interview Questions

How to upload a file to the server using servlet?

0 Answers  


Hello, My project requirement is like I need to create a web page using MVC pattern. I hava a bean class, jsp page, servlet, service and dao. My jsp has two fields. One is dropdown list. The option values has to get populated from the database table. The other one is a text box and its value has to come from database table. As of now I have defined the fields in bean class, got the values from database using arraylists in dao class and I called this from service class. Can anyone please tell me the workflow of how the servlet will get this arraylist and populate the arraylist values as dropdown options in jsp page? Also I would like to know the role of bean class in MVC pattern? Thanks in advance!

0 Answers  


Which is the methods of generated servlet?

0 Answers  


How will two or three servlets interact or communicate with each other?

0 Answers  


How do you invoke a Servlet? What is the difference between doPost method and doGet method?

0 Answers  






Explain the difference between a web server and a web container?

0 Answers  


What is Servlets and explain the advantages of Servlet life cycle?

0 Answers  


What are all the advantages of servlet over cgi?

0 Answers  


What is java servlet session?

0 Answers  


What is the default HttpRequest method?

6 Answers  


Explain session tracking and its importance?

0 Answers  


Which event is fired at the time of setting, getting or removing attribute from application scope?

0 Answers  


Categories