What is the difference between JSP and Servlets ?
JSP is used mainly for presentation only. A JSP can only be HttpServlet that means the only supported protocol in JSP is HTTP. But a servlet can support any protocol like HTTP, FTP, SMTP etc.
What is difference between custom JSP tags and beans?
Custom JSP tag is a tag you defined. You define how a tag, its attributes and its body are interpreted, and then group your tags into collections called JSP Tag libraries that can be used in any number of JSP files. To use custom JSP Tags, you need to define three separate components: the tag handler class that defines the tag's behavior ,the tag library descriptor file that maps the XML element names to the tag implementations and the JSP file that uses the tag library
JavaBeans are Java utility classes you defined. Beans have a standard format for Java classes. You use tags
Custom tags beans accomplish the same goals -- encapsulating complex behavior into simple and accessible forms. There are several differences:
Custom tags can manipulate JSP content; beans cannot. Complex operations can be reduced to a significantly simpler form with custom tags than with beans. Custom tags require quite a bit more work to set up than do beans. Custom tags usually define relatively self-contained behavior, whereas beans are often defined in one servlet and used in a different servlet or JSP page. Custom tags are available only in JSP 1.1 and later, but beans can be used in all JSP 1.x versions.
What is servlet mapping?
The servlet mapping defines an association between a URL pattern and a servlet. The mapping is used to map.
Can we use the constructor, instead of init(), to initialize servlet?
Yes. But you will not get the servlet specific things from constructor. The original reason for init() was that ancient versions of Java couldn’t dynamically invoke constructors with arguments, so there was no way to give the constructor a ServletConfig. That no longer applies, but servlet containers still will only call your no-arg constructor. So you won’t have access ServletConfig or ServletContext.
How many JSP scripting elements are there and what are they?
There are three scripting language elements: declarations, scriptlets, expressions requests to Servlets.
0 Comments
What is a translation unit? How do I have the JSP-generated servlet subclass my own custom servlet What are the common mechanisms used for session tracking? What are the different scope valiues for the ? What is a output comment? How to overwrite the init and destroy method in a jsp page. What is the architecture of JSP? What is jsp:use bean. What are the scope attributes & difference between these attributes? How can I set a cookie and delete a cookie from within a JSP page? |