Andrew Rigsby

Greenhorn
+ Follow
since Oct 05, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Andrew Rigsby

The thread pool executor takes a blocking queue as its argument (i.e. the work queue) which according to the API’s is used for “… holding tasks before they are executed”

If a thread pool executor is permitted a maximum of 2 threads and has a fixed size work queue of 1 ….. if the main thread calls submit() twice before one of the pooled threads has a chance to execute will this result in the second call to submit() throwing an exception because of the size of the work queue being exceeded.

I’m just slightly confused by the following description from the API:

• If fewer than corePoolSize threads are running, the Executor always prefers adding a new thread rather than queuing.
• If corePoolSize or more threads are running, the Executor always prefers queuing a request rather than adding a new thread.
• If a request cannot be queued, a new thread is created unless this would exceed maximumPoolSize, in which case, the task will be rejected.

As “fewer than corePoolSize threads are running”, i.e. no threads are running, does the work queue actually get used (and so is its size relevant)?
I'm trying to add components to the JSF tree at runtime within an event listener but the added components aren't displayed. My code is as follows:

*** jsp page ***
<h:form id="jsfForm">
<h:commandButton type="submit" value="Submit" immediate="true" action="#{actionBean.processAction}">
</h:commandButton>
</h:form>

*** actionBean.processAction implementation ***
FacesContext fContext = FacesContext.getCurrentInstance();
Application app = fContext.getApplication();
UIViewRoot view = fContext.getViewRoot();

UIComponent form = view.findComponent("jsfForm");
HtmlOutputText newComponent = (HtmlOutputText) app.createComponent("javax.faces.HtmlOutputText");
newComponent.setId(view.createUniqueId());
newComponent.setRendered(true);
newComponent.setValue("Text");
form.getChildren().add(newComponent);

return "success";

Could anyone suggest why the added HtmlOutputText component isn't displayed?
15 years ago
JSF
Hi,

I'm considering taking the SCDJWS exam but before I did I wanted to know how recent the current version of the exam is and whether SUN have any plans to change/update the exam in the near future?

Regards,

Andy
Thanks!! That was very useful!!

One more thing, what are Mikalai's notes?
I've seen that SUN have now made available the official SCBCD 5.0 exam.

Does anybody know of any good books that would prepare you for the exam? Also, is there a 'Head First' book for this exam in the pipeline?
Thanks!!

So, if asked in the SCWCD exam whether request scoped attributes are thread safe the answer is 'Yes'.

Do you need to consider the fact that a reference to the request attribute may be being used in another part of the application in the exam?
Are request scoped attributes thread safe?

I originally thought they were until I read an article on the Internet which seems to have confused me! Can anyone clarify this for me?

Thanks!!
For simple tags implementing the SimpleTag interface, the setParent() method is only called when a tag has an enclosing parent.

Is this also the case for classic tags? In other words, is the Tag.setParent() method only called when a tag has an enclosing parent or is the method always called?

Cheers!!
Hi,

Is it possible to have two <error-page> declarations in the DD for the same error-code or exception-type?

For example, if you have the following:

<error-page>
<error-code>404</error-code>
<location>/pages/error_page_1.jsp</location>
</error-page>

<error-page>
<error-code>404</error-code>
<location>/pages/error_page_2.jsp</location>
</error-page>

... which error page is displayed?
For the SCWCD exam, are you tested on the deprecated classes and methods e.g. HttpSession.putValue(), HttpSession.getValue() etc?
Yeah, that's more or less what I have:

<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

I'm using Tomcat 5.5.
When you define authentication in the deployment descriptor using the following:

<login-config>
<auth-method>BASIC | DIGIST | FORM etc... </auth-method>
</login-config>

... how do you 'log out' the user once they have been authenticated so that another user can login and authenticate?

The reason I ask is because once I've authenticated one user I don't know how to terminate the users session so that another user can login.
Thanks.

I've checked the version of my web.xml and it specifies 2.4. Tomcat still continues to load the servlet with a <load-on-startup> of 1 before the servlet with a <load-on-startup> of 0.
Hi,

I've read that the <load-on-startup> element allows you to specify that a servlet is loaded at deployment time if it defines a value greater than 0. However, I've also read that it allows you to specify the order of servlet loading.

What I wanted to know was that if one servlet has a <load-on-startup> value of 0 and another servlet has a value of 1, which is loaded first?

I assumed it would be the servlet with the lower value, i.e. 0, but when I try it out in Tomcat the servlet with the <load-on-startup> of 1 loads first?

Thanks!!
Hi,

I understand that when a request is made to a web application's servlet, the request is delegated to the web container by the web server. The container then locates the relevant servlet class, creates the HttpServletRequest & HttpServletResponse objects and allocates a thread for the request.

What I wanted to know was ... does each web application run in a seperate instance of the web container or does a single web container manage all web applications?

Thanks!!