Jayashree Mohan

Ranch Hand
+ Follow
since Nov 23, 2005
Merit badge: grant badges
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jayashree Mohan

The tag names, attribute and their values are all case "insensitive".
Is this statement true?
In question 21 (Page 809) , the first tag element specifies that the attribute is "false", then how come answer D) is also rite ???

<jsp:useBean id = "bean" class="JBean" />
<jsp:setProperty name="bean" property="*">
Title : <%=bean.getTitle()%> <br>
Num : <jsp:getProperty name="bean" property="num" />

Bean class:

public class JBean
private String title = "JBean";
private int num;
public void setTitle(String t){ this.title = t; }
public String getTitle(){ return this.title; }
public void setNum(int n){ this.num = n; }
public int getNum(){ return this.num; }

THis is the URL
The response printed was
Title : null
Num : 0

Shouldn't Title be printed Hello instead of null since property="*" ???

Is this rite?


- The session will never expire

but when session.setMaxInactiveInterval(0) is called the session is deleted immediately like session.invalidate().

Am I correct on this?
Consider the following
<%@ page language="java" import="com.mypackage.MyBean" %>
<jsp:useBean id="myBean" class="MyBean"/>
<jsp:setProperty name="myBean" property="myProperty" value="<%=request.getParameter("sentProperty")%>"/>


Package com.mypackage;

Public class MyBean
private String myProperty;
public MyBean(String myProperty)
this.myProperty= myProperty;
public void setMyProperty(String myProperty)
this. MyProperty= myProperty;
public String getMyProperty()
return myProperty;

Will this give a compilation/translation error? (Beans cannot have constructors with arguments)
Thanks !! That was very informative
What is the result displayed on the browser when the First.jsp is accessed.


<%@ page language="java" import="com.mypackage.MyBean" %>
<jsp:useBean id="myBean" class="MyBean" scope="session" />
<jsp:setProperty name="myBean" property="myProperty" value="FirstValue"/>
<jsp:include page="Second.jsp"/>
<jsp:getProperty name="myBean" property="myProperty"/>


<%@ page language="java" import="com.mypackage.MyBean" %>
<jsp:useBean id="myBean" class="MyBean" scope="application"/>
<jsp:setProperty name="myBean" property="myProperty" value="SecondValue"/>

The mock exam indicated that this would give a "compiler error". Since the jsp action tag was used, there shud be no problem while compiling.I think this shud compile and print the value "SecondValue"?

Am I rite??
During initialization, the servlet instance can throw which exception.


My answer was B. but the mock exam said it was C. Now which is rite and why ??Need some help on this.
What is the Default value for body-content element of tag library descriptor? Is it JSP/scriptless? Am confused?

What is the default value for body-content for Simple and Custom Tag Handlers?
Given the following tag handler defined with <bodycontent>JSP</bodycontent>

public class body extends TagSupport {
public int doStartTag() throws JspException{
public int doAfterBody() throws JspException {
try { pageContext.getOut().print("how are you?"); }catch(IOException e) {}
return SKIP_BODY;

what will be printed out by the following part of a jsp page?

1) The tag handler won't compile.
2) The jsp page will print Hello how are you?
3) The jsp page will print how are you? Hello
4) The jsp page will print Hello

The mock exam gives the answer as 4) but I feel its 2). The explanation given was "you can't print from doAfterBdoy in a TagSupport handlers".
Is the answer and explanation rite??
The answer is Model-View-Controller . Since there are 2 views the browser and WAP enabled view, this design pattern is best suited.
Which of the following staments are correct about the following jsp lines:

<jsp:useBean id=�name� class=�java.lang.String� />

<%= name %>

1) It won't compile.
2) It is a valid jsp line and it will print the variable called name.
3) It will compile but it will always produce null as the output.
4) It will work if you create a javabean class with only one variable of type java.lang.String.

The answer in the mock exam was 2) .
How is this possible??
Which attributes are mandatory while defining an individual tag?
In one of the mock exams it was given , name and tag-class are mandatory? Is that all ?

Need help on this
Which of the given statements are correct regarding the following JSP page code?

<jsp:useBean id="mystring" class="java.lang.String" />
<jsp:setProperty name="mystring" property="*" />

Assume that the request for this page contains a parameter mystring=hello.

In the jdiscuss exam, the answer is 'It will print "" '.
How is this possible?