wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Niko's Mock Exam - Servlets - Doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Niko Watch "Niko New topic
Author

Niko's Mock Exam - Servlets - Doubt

B Muthusamy
Greenhorn

Joined: Mar 08, 2013
Posts: 4
Hello ranchers,

The following is question NO:41 from Niko's mock test for servlets.

Consider this code.
package library;
public class Book {
private String title;
public Book() {}
// get and set methods
}

<%-- input.jsp --%>
<html>
<body>
<form action="output.jsp">
<input type="text" name="title" value="Mathematics"/>
<input type="submit" value="OK" />
</form>
</body>
</html>

<%-- output.jsp --%>
<jsp:useBean id="book" class="library.Book" scope="request" >
<jsp:setProperty name="book" property="title" param="*" />
</jsp:useBean>
<html>
<body>
I like <jsp:getProperty name="book" property="title" />!
</body>
</html>

What is the output when the form is submitted? (1 correct answer)
a. I like null!
b. I like Mathematics!

The correct answer is a. I am unable to get why. Param=* synchronizes all request parameters with useBean right?
Can you help me with this? Thanks!!
B Muthusamy
Greenhorn

Joined: Mar 08, 2013
Posts: 4
Got the answer! It is the syntax of jsp:setProperty standard action.

<jsp:setProperty name="book" property="title" param="*" /> - this is wrong

<jsp:setProperty name="book" property="*" /> - correct way..
 
Don't get me started about those stupid light bulbs.
 
subject: Niko's Mock Exam - Servlets - Doubt
 
Similar Threads
doubt in paramValues(EL)
jsp:usebean confusion
bean value gives null
Related to useBean
give another jsp to action