A hyHow does multithreading take place on a computer with a single CPU?(3 marks)

Ans:

It is the responsibility of scheduler to organise multiple tasks by allocating execution time to each task, in such a way that it seems to be executed in a sequential fashion to rest of the world.

What are the two ways to read initialization parameters of a servlet? 5 marks

The ServletConfig object can be used to read initialization parameter.

public void init(ServletConfig config) throws ServletException {

string name =config.getInitParameter(“paramName”);

}

Another way to read initialization parameters out side the init () method is

Call getServletConfig() to obtain the ServletConfig object

Use getInitParameter() of ServletConfig to read initialization parameters

public void anyMethod// defined inside servlet{

ServletConfig config = getServletConfig();

String name = config.getInitParameter(“param_name");

}

What is meant by Twin Tag Libraries?(5 marks)

JSTL comes in two flavors to support various skill set personal

Expression Language (EL) version :

- Dynamic attribute values of JSTL tags are specified using JSTL expression language (i.e. ${expression})

The EL based JSTL tag libraries Sql,Core,Internationalization/ Format ,XML having prefixes of c,sql,fmt,x

Request Time (RT) version:

- Dynamic attribute values of JSTL tags are specified using JSP expression

(i.e. <%= expression %>)

The RT based JSTL tag libraries Sql,Core,Internationalization/ Format ,XML having prefixes of c_rt,sql_rt,fmt_rt,x_rt

What impact a JavaBeans object can produce when it is stored in Page scope? (3 marks)

Beans created with page scope are always accessed (their values) by jsp:getProperty,jsp:setProperty, scriptlets or expressions.when MyBean object , are not available. BEAN specify scope “page” results in using the object on the same page where they are created.

The scope attribute is optional and default to page.

A page scoped variable is set to value of request parameter by using

paramimplicit object. If parameter is defined in JSP page as:

<input type=”text” value = “parameter” />

Can a vector contain heterogenous objects? If yes then explain why?(3 marks)

Ans: Yes a Vector can contain heterogenous objects. Because a Vector stores everything in terms of Object.

How does JSF provide Navigation?(3 marks)

Page navigation determines the control flow of a Web application. JSF provides a default navigational handler and this behavior can be configured in configuration. However, you can do it visually in most tools like Sun Studio Creator

How can we read cookies from the client? (3 marks)

To read the cookies that come back from the client, following steps are generally followed.

Reading Cookies from the Client

To read incoming cookies, get them from the request object of the HttpServeltRequest by calling following method

Cookie cookie s[] = request.getCookies();

This call returns an array of Cookies object corresponding to the name & values that came in the HTTP request header.

Looping down Cookies:

Once you have an array of cookies,you can iterate over it. Two important methods of Cookie class aregetName() and getValue().These are used to retrieve cookie name and value respectively.

Write the code of java beans class named as "MyBean" and having an attribute named "name" of String data type.

5 marks

package My Bean;

port java.io.*;

Public class MyBeanClass implements Serializable{

private String name;

// no argument constructor

public MyBeanClass() {

name = "";

}

//setter

public void setName(String n){

name = n;

}

// getters

public String getName( ){

return name;

}

} // end class MyBeanClass

What are the high-level thread states?2 mark

The high-level thread states are runable,running ,waiting,sleeping,blocked,blocked on i/o

Name any two typical solutions of session tracking?

The typical solutions come across to accomplish session tracking. These are:

1 Cookies

2 URL Rewriting

Write the syntax of Update SQL query.

Used to execute for INSERT, UPDATEor DELETE SQL statements.

For example,

int num = stmt.executeUpdate(“DELETE from Person WHERE id = 2” );

What type of problem persists with Struts Framework?

Struts Framework creates following problems

Adds complexity and doesn’t provide UI tags

Very Java programmer centric

What is the meaning of error page if after using url in internet explorer an error appear showing error status 404 at server side?

Ans:

The 404 or Not Found error message is a HTTP standard response code in TOMCAT indicating that the client was able to communicate with the server, but the server could not find what was requested.

How does multithreading take place on a computer with a single CPU?(3 marks)

Ans:

t is the responsibility of scheduler to organise multiple tasks by allocating execution time to each task, in such a way that it seems to be executed in a sequential fashion to rest of the world.

What are the two ways to read initialization parameters of a servlet? 5 marks

The ServletConfig object can be used to read initialization parameter.

public void init(ServletConfig config) throws ServletException {

string name =config.getInitParameter(“paramName”);

}

Another way to read initialization parameters out side the init () method is

Call getServletConfig() to obtain the ServletConfig object

Use getInitParameter() of ServletConfig to read initialization parameters

public void anyMethod// defined inside servlet{

ServletConfig config = getServletConfig();

String name = config.getInitParameter(“param_name");

}

What is meant by Twin Tag Libraries?(5 marks)

JSTL comes in two flavors to support various skill set personal

Expression Language (EL) version :

- Dynamic attribute values of JSTL tags are specified using JSTL expression language (i.e. ${expression})

The EL based JSTL tag libraries Sql,Core,Internationalization/ Format ,XML having prefixes of c,sql,fmt,x

Request Time (RT) version:

- Dynamic attribute values of JSTL tags are specified using JSP expression

(i.e. <%= expression %>)

The RT based JSTL tag libraries Sql,Core,Internationalization/ Format ,XML having prefixes of c_rt,sql_rt,fmt_rt,x_rt

What impact a JavaBeans object can produce when it is stored in Page scope? (3 marks)

Beans created with page scope are always accessed (their values) by jsp:getProperty,jsp:setProperty, scriptlets or expressions.when MyBean object , are not available. BEAN specify scope “page” results in using the object on the same page where they are created.

The scope attribute is optional and default to page.

A page scoped variable is set to value of request parameter by using

paramimplicit object. If parameter is defined in JSP page as:

<input type=”text” value = “parameter” />

Can a vector contain heterogenous objects? If yes then explain why?(3 marks)

Ans: Yes a Vector can contain heterogenous objects. Because a Vector stores everything in terms of Object.

How does JSF provide Navigation?(3 marks)

Page navigation determines the control flow of a Web application. JSF provides a default navigational handler and this behavior can be configured in configuration. However, you can do it visually in most tools like Sun Studio Creator

How can we read cookies from the client? (3 marks)

To read the cookies that come back from the client, following steps are generally followed.

Reading Cookies from the Client

To read incoming cookies, get them from the request object of the HttpServeltRequest by calling following method

Cookie cookie s[] = request.getCookies();

This call returns an array of Cookies object corresponding to the name & values that came in the HTTP request header.

Looping down Cookies:

Once you have an array of cookies,you can iterate over it. Two important methods of Cookie class are getName() and getValue().These are used to retrieve cookie name and value respectively.

Write the code of java beans class named as "MyBean" and having an attribute named "name" of String data type.

5 marks

package My Bean;

port java.io.*;

Public class MyBeanClass implements Serializable{

private String name;

// no argument constructor

public MyBeanClass() {

name = "";

}

//setter

public void setName(String n){

name = n;

}

// getters

public String getName( ){

return name;

}

} // end class MyBeanClass