BO KANG

Greenhorn
+ Follow
since Jun 19, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by BO KANG

Thanks a lot for such elaborate discussion on that.
Dear Ranchers:

I found one issue when i do the mock exam from http://j2eeworld.weebly.com

public class MyServlet extends HttpServlet {
private int x = 0;
public MyServlet (int x) {
this.x = x;
}
public void doGet (HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
x++;
PrintWriter out = response.getWriter();
out.println(x);
}
}
What will be the output (assume all imports are done correctly), when invoking MyServlet ?

A.Compiler error

B.Runtime Exception

C.Prints 1 in browser window.

D.Prints the value of x in browser window , depending up on the value used to create the servlet.

The answer is B,but why?Could you give me some hint?

And another issue is if i override doPost,but not doGet in the servlet,and in my jsp,I use the method="POST",are there some problem or not ?

Thanks anyway.
Hey,Ranchers:

One issue in Custom tag :

Which two are concerning the objects available to developers creating tag files?

A.The session object must be declared explicity.
B.The request and response objects are available implicity.
C.The output stream is available through the implicit outStream object.
D.The servlet context is available through the implicit servletContext object.
E.The JspContext for the tag file is available through the implicit jspContext object.

Multiple choice,actually i have doubts of this question ?!

In the tag file ,it is forbidden to use scriptlet ,so how could it use JSP implicit object

Thanks a lot
Hey ranchers:

One question about Filter mapping sequence :

Given these filter mapping declarations:

<filter-mapping>
<filter-name>FilterOne</filter-name>
<url-pattern>/admin/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>

<filter-mapping>
<filter-name>FilterTwo</filter-name>
<url-pattern>/users/*</url-pattern>
</filter-mapping>

<filter-mapping>
<filter-name>FilterThree</filter-name>
<url-pattern>/admin/*</url-pattern>
</filter-mapping>

<filter-mapping>
<filter-name>FilterTwo</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

in what order are the filters invoked for the following browser request?
/admin/index.jsp

a FilterOne, FilterThree
b FilterOne, FilterTwo, FilterThree
c FilterThree, FilterTwo
d FilterThree, FilterTwo
e FilterThree
f None of these filters are invoked.

The answer is d,but i think it should be FilterOne FilterThree FilterTwo?

Thanks
A JSP document is a JSP page written in XML syntax as opposed to the standard syntax JSP Page. Because it is written in XML syntax, a JSP document is also an XML document and therefore gives you all the benefits offered by the XML standard:

You can author a JSP document using one of the many XML-aware tools on the market, enabling you to ensure that your JSP document is well-formed XML.
You can validate the JSP document against a document type definition (DTD).
You can nest and scope namespaces within a JSP document.
You can use a JSP document for data interchange between web applications and as part of a compile-time XML pipeline.

In addition to these benefits, the XML syntax gives the JSP page author less complexity and more flexibility. For example, a page author can use any XML document as a JSP document. Also, elements in XML syntax can be used in JSP pages written in standard syntax, allowing a gradual transition from JSP pages to JSP documents.

E.g
Jsp page : <%=expression %>
Jsp document: <jsp:expression></jsp:expression>

Hope this will help you
Question 12

Which three occur during JSP page translation?(Choose three)

A.The jspInit method is called
B.The JSP page implementation class is created
C.The JSP page implementation class is compiled
D.The JSP page is validated for syntatic correctness
F.The associated tag files are validated for syntatic correctness.

The answer is BCD,but i think option C is not correct,because that is after translation process ,in the compilation process.

Another thing is for option F, when does the web container check its syntax?

Thanks
hey,ranchers:

I have one doubt in the chapter Scriptless JSP in HFSJ .The second question in the mock exam in this chapter:

Given that a web application stores the webmaster email address in the servlet context initialization parameter called master-email.

Which retrieves that value:

The answer: <a href='mailto:${initParam['master-email']}'>email me</a>

but i think the option A is correct as well :

The answer: <a href='mailto:${initParam.master-email}'>email me</a>

??

Thanks