This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
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()
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 ]
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??
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.
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.
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.*ʼ %>
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
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
posted
0
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
posted
0
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.
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.
${"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
posted
0
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 ]
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.
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: 35246
7
posted
0
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.
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.
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??
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: 35246
7
posted
0
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.
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.