Chapter 6 Explain what are three rules that a javaBean must follow. How can EL h
ID: 3888081 • Letter: C
Question
Chapter 6
Explain what are three rules that a javaBean must follow.
How can EL help you to work with a javaBean?
What is the disadvantage of using application scope?
Name four types of JSP tags and briefly explain their puposes.
What are 3 ways of coding comments in JSP? Explain what how these 3 differs from each other.
Name four scope values that a bean or any other object can stored in. Briefly describe each scope (what are their corresponding objects)
How can you include a file in a JSP at compile-time?
How can you include a file in a JSP at runtime?
What is difference between runtime and compile-time?
Common HTTP status you might see in running your web application:
HTTP Status 404 means Not found error which means the page user trying to reach on the website is not found in the server.
HTTP Status 500 means Internal Server Error.
Explanation / Answer
java bean rules
· It is a public class.
· It has a public parameterless constructor (though it may have other constructors as well)
· It implements Serializable interface (i.e. it can be made persistent, so its state can be saved)
· It has properties with “getter” and “setter” methods named by following JavaBeans naming patterns
· It has events which follow the standard Java event model with the registration methods named by following the JavaBeans naming patterns
· It may have other methods which do not follow the naming patterns. These methods are not exposed by a builder tool.
How can EL help you to work with a javaBean?
El makes it easily access application data stored in javaBean component
JSP EL allows you to create expressions both (a) arithmetic and (b) logical.
1. Directives
These types of tags are used primarily to import packages. Altenatively you can also use these tags to define error handling pages and for session information of JSP page.
2. Declarations
JSP declarations starts with '<%!' and ends with '%>'. In this you can make declarions such as int i = 1, double pi = 3.1415 etc. If needed, you can also write Java code inside declarations.
3. Scriptlets
JSP Scriptlets starts with '<%' and ends with '%>'. This is where the important Java code for JSP page is written.
4. Expressions
JSP expressions starts with '<%=' and ends with '%>'. If you want to show some value, you need to put it in between these tags.
1 Content Comments
Syntax: < !- – description – ->
2. JSP Comments
Syntax: <%- – / * description */ – -%>
3 Scripting Comments
Syntax: <% / * description */ %>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.