What is the output at line 6 of the following code fragment? Consider that "postageType" already exists in the session.
1.<jsp:useBean id="postageType" scope="session"
2. class="com.baboon.scwcd.PostageType" >
3. <% postageType.setType("First Class"); %>
4.</jsp:useBean>
5.
6.<%= postageType.getType() %>
what will be thew out put:
1 The output is: First Class
2 The output is: Second Class
3 The output is undetermined.
4 Compile time error.
5 Runtime error.
i have a doubt what and all we can use inside standard actions(scriplet,expressions,el...) what wil be the impact on the code how it wil behave because the answer they had given for this is.
Answer 3 is correct.
The bean postageType is already present in the session scope, the JSP engine will skip the body of the useBean tag.
The scriplet code at line 3 is not executed.The output of the scriplet code at line 6 cannot be predicted, the property has been set somewhere else.
A Java Bean is instantiated with the no-argument constructor in JSP pages, this does not give the Bean developer the opportunity to initialize the bean. If the bean was not present in the session the scriplet code from line 3 would have been executed, and the bean would be inititialized with "First Class".
This mechanism has been introduced to initialize Java Beans in JSP pages.
and every thing for me is confusion...please if any one with detail can help me..