aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Hints for SCWCD Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Hints for SCWCD" Watch "Hints for SCWCD" New topic
Author

Hints for SCWCD

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9388
    
    2

Ranchers,

I wanted to start a thread for posting some things related to SCWCD...something like points to remember...If anyone has similiar ideas, you can post them here. So to start off,

A jsp:forward effectively terminates the current page. Nothing before the jsp:forward or after the jsp:forward is written to the response! It is not the samw when using a requestDispatcher.forward()


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9388
    
    2

Here is the second one,

A pageContext implicit object knows about all other jsp implicit objects and it has methods to get hold of them.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

http://java.boot.by/wcd-guide/


[My Blog]
All roads lead to JavaRanch
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9388
    
    2

Satou,

I'm just putting things here as and when I come across studying them.

So here comes the third one.

Of the big 7 HTTP methods,

SAFE >> GET, HEAD, TRACE, OPTIONS
IDEMPOTENT >> GET, HEAD, TRACE, OPTIONS, PUT, DELETE
NON-IDEMPOTENT >> POST
Nicky Eng
Ranch Hand

Joined: Mar 26, 2005
Posts: 378
had you sit for the test yet?
----


From NickyEng
Diploma in Computer Studies
SCJP 1.4
SCWCD 1.4
Formula 1 app by Maxis (Playbook)
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9388
    
    2

No. I'm planning for it sometime in june this year!
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9388
    
    2

Here comes the next one, perhaps a basic thing

A value of 0 or a negative value in the session-config in the web.xml file (which is expressed in minutes) indicates that the session never expires. However, this can be overridden using the setMaxInactiveInterval() in the code where the time is in seconds.
[ April 25, 2007: Message edited by: Jothi Shankar Kumar Sankararaj ]
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

A value of 0 or a negative value in the session-config

You mean in the session-timeout of the session-config ?
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9388
    
    2

Yes Satou. By the way one more doubt I have is that, when we call invalidate() on the session and then we try to access any methods of the HttpSesion interface, we get an IllegalStateException but we don't get this exception for the get and setMaxInactiveInterval(), and getServletContext() methods?? WHY??
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9388
    
    2

The next one,

Beware of the deprecated encodeUrl and encodeRedirectUrl methods. They have mixed casing for the Url.
Atul Sawant
Ranch Hand

Joined: Jul 06, 2006
Posts: 304
Hi Jothi,

Could you please let me know what do you meant by saying "mixed casing"?


Mission SCWCD. Mission SCJP Complete: SCJP 1.4 - 91%
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Could you please let me know what do you meant by saying "mixed casing"?

In HttpServletResponse, there are both encodeUrl and encodeURL. The former is deprecated. Same for encodeRedirectUrl.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9388
    
    2

Here comes the next one,

The servlets created from the JSP page have to obey some special rules, a vendor will typically have a specialized jsp base servlet-perhaps extending HttpServlet or GenericServlet. In Tomcat, this is called org.apache.jasper.runtime.HttpJspBase.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9388
    
    2

The next one,

If a jsp page fails to translate, then any request to that page should return a 500(server error) communicated back in the HTTP response.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9388
    
    2

The next one,

Don�t be thrown by weird but legal variants for directive syntax. You don�t need white space after the opening marker or before the closing marker:
<%@page import="java.util.*"%> You can also put extra white space before
or after the equal sign for the attribute: <%@ page import = "java.util.*"%>
Single quotes are as acceptable as double quotes for attribute values:
<%@ page import=ʼjava.util.*ʼ %>
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9388
    
    2

The next one,

There are 4 page directives required to be known for the exam. They are,

<%@ Page import...%> -- Can appear any number of times and anywhere in the jsp
<%@ Page session...%>-- Can appear only one time at the top of the page, if left, default is true or in other words the session object is available to the jsp page
<%@ Page contentType...%> -- Can appear only one time at the top of the page
<%@ Page isELIgnored...%> -- Can appear only one time and at the top of the page, by default it is false
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

can appear only one time

Actually, you are allowed to have it multiple times, as long as the value is the same.

There shall be only one occurrence of any attribute/value pair defined by this directive in a given translation unit, unless the values for the duplicate attributes are identical for all occurrences.
Yasser Almohammad
Greenhorn

Joined: Feb 11, 2007
Posts: 12
Let's assume you have a customerBean which has an address property object. This address object has a city property.

so to set the city property of the customerBean.address object using the appropriate JSTL tags?
<c:set target="${customerBean.address}" property="city" value= "${city}" />


SCJP<br />SCWCD
Yasser Almohammad
Greenhorn

Joined: Feb 11, 2007
Posts: 12
Consider the following code:
public class MyHttpSessionListener implements HttpSessionListener
{
public void sessionCreated (HttpSessionEvent e)
{
System.out.log ("Session Created");
}

public void sessionDestroyed (HttpSessionEvent e)
{
HttpSession session = e.getSession ();
String name = (String) session.getAttribute ("username");
}
}


at code execution, an IllegalStateException will be thrown when the session.getAttribute ("name") is called.
By the time the servlet container calls the sessionDestroyed () method, the session has already been invalidated. Therefore a call to getAttribute () will throw an IllegalStateException.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9388
    
    2

The next one,

Expression Language can be enabled or disabled in three different ways. We
encountered one of these ways in Chapter 6, when we looked at the page
directive settings. The page directive attribute isELEnabled can turn on EL
for a single page�or not.
There are a couple of alternative ways of controlling EL enablement
that aren�t explicit exam objectives. One is with the <jsp-propertygroup>
element, which has a subelement <el-enabled>. We met <jspproperty-
group> in the context of identifying JSP documents (subelement
of <jsp-config> .
Finally, EL is enabled at an application level by having a deployment
descriptor at servlet level 2.4. A previous deployment descriptor level indicates that EL should be switched off.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9388
    
    2

The next one,

You have to keep java code (like scriptlets, expressions) free of EL
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9388
    
    2

The next one,

${"Not a Number"+ 3.0}. You will get a javax.servlet.jsp.el.ELException, complaining that �Not a Number� cannot be converted to a java.lang.Double value. This example also goes to show that the addition operator in EL�unlike Java�is not overloaded to handle string concatenation. There�s no operator overloading or string concatenation in EL.
Sunder Ganapathy
Ranch Hand

Joined: Apr 01, 2003
Posts: 120
1. It is not correct to assume that everybody is reading David Bridgewater's book .
2. Chapter 6 in HFSJ is on Session Management.
3. There is no isELEnabled attribute for page directive.
4. It is isELIgnored.
5. Instead of just doing cut and paste, it would be better if it is written in one's own words, covering the particular topic in its entirety.
6. jsp-property-group has subelement el-ignored and NOT el-enabled.[ April 26, 2007: Message edited by: Sunder Ganapathy ]
[ April 26, 2007: Message edited by: Sunder Ganapathy ]
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Jothi,
maybe it would be better to collect your hints in one file and put it somewhere where we can access it. Hints without categories may not be very useful for other ranchers.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9388
    
    2

Satou,

It's a good idea what you suggested is to put all the hints in one file arranged topic wise and maybe put it somewhere in the server so that everyone can access it. I'll start working on it right away.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41905
    
  63
It's a good idea what you suggested is to put all the hints in one file arranged topic wise and maybe put it somewhere in the server so that everyone can access it.


How about a wiki page right here on JavaRanch? We'd be glad to host it. I've started one here. If you're not strong with wikis, don't worry, someone will clean up the formatting (if necessary). Or you could send the material to one of the moderators (e.g., me) who would put it up for you.


Ping & DNS - my free Android networking tools app
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9388
    
    2

Good suggestion Ulf! So how should I go about posting the hints there?? I'm able to see the link that says Scwcd links...I just click the edit button and start typing??

Also you were mentioning some Wiki....are you talking something like a wikipedia kind of in javaranch?? That would also be an interesting thing to do here at the ranch.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9388
    
    2

Ulf,

We can try to organize it topic wise. I visited the page and I want to have something like this...Topics in the form of hyperlinks and once you click them it expands with something kind of points to remember like 1,2,3 with examples if necessary...Does this sounds good??
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Information about page formatting of the wikis are here :
http://faq.javaranch.com/view?PageFormatting

The SCWCD FAQ is also made this way. You can try to see how it is built be pressing the "edit this page" button :
http://faq.javaranch.com/view?ScwcdFaq
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41905
    
  63
I'm not a big fan of those tables in the SCWCD page (I think they distract from the content), but otherwise the format is nice. It may make less sense if the individual hints do not really have a question or a title to go with them. But there are no absolute rules, and we have pages with many different styles, so I wouldn't worry too much about the layout. Wikis are always evolving, anyway.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9388
    
    2

Alright Ulf, I'll start adding the contents there and may be if you find my language awkward please go ahead and edit them.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9388
    
    2

Ulf,

I started adding the contsnts to the page. Maybe you can check at it and let me know if they look okay.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

And don't forget to correct the part about "can appear only one time"
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9388
    
    2

Satou,

Can the other ones (other than page import) appear anywhere in the jsp page? I'll add this as well in the Scwcd hints...
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Only pageEncoding and contentType should appear at the beginning of the page.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9388
    
    2

Thanks Satou!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41905
    
  63
That looks good, Jothi. Nice work.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9388
    
    2

Ulf,

First of all I should thank you for creating such a space "Scwcd Hints" here at javaranch.

I would be even happy, if I'm able to format the contents better. Like for point number 11 which talks about the difference between <%@ page...> directive and <@ include...> I wanted to have a table and I tried but failed in doing so.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9388
    
    2

It would also be good if fellow ranchers can as well post their hints...well what do you guys say??
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9388
    
    2

Ulf,

When the Scwcd Hints gets hot, may be we can add a link in the top of the forum. What do you suggest??
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hints for SCWCD