chris noe

Greenhorn
+ Follow
since Aug 20, 2003
Merit badge: grant badges
For More
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 chris noe

Hi,

I'm trying to lookup a local session bean, but keep getting NameNotFoundException.

in my bean interface i have :
@Local
public interface InsurabilityFacade {...
In the implementation :
@Stateless(name="InsurabilityFacade")
public class InsurabilityFacadeImpl implements InsurabilityFacade {...

In my webservice endpoint, where i lookup the bean i have :


@EJB(name="InsurabilityFacade", beanInterface=InsurabilityFacade.class)
(also tried @EJB private InsurabilityFacade insurabilityFacade; )

I thought that would have the stateless session bean in the insurabilityFacade object. But the object remains null.
Shouldn't the @EJB do the lookup ?
Not only, i have to do the lookup explicitly as:
insurabilityFacade = (InsurabilityFacade)context.lookup("ejb/InsurabilityFacade");

I also have to have an entry in my web.xml

<ejb-local-ref>
<ejb-ref-name>ejb/InsurabilityFacade</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local>be.cm.apps.insurability.business.InsurabilityFacade</local>
</ejb-local-ref>

Can't i us my session bean in my webservice endpoint without the explicit lookup and the entry in the web.xml ?

Grtz,
Chris.
15 years ago
Paolo,

I found the classic and simple tag good, but the tag-file was not covered enough. Try to find some examples on the internet so that you understand them better. If you study security, just read the security piece in the servlet 2.4 spec's. It's only 10 or 15 pages, but there some extra info that could come in handy.
One thing i still remember about the book is that in the sessionDestroyed method of the httpsessionlistener, you can't use the session anymore. But this has changed in the new spec. Now you can.

I didn't used the hfsj book so i can't say anything about it. But i heard it is quit good.

The book i used for my scjp was also from Kathy Sierra, and that one was very good.

Grtz,
Chris.
Hello
I did my SCWCD today and passed with 81%.
Of course thanks to the peopler of JavaRanch and al posters. They really helped me a lot !
About the exam :
A lot of EL and tag (classic, simple an tag files), javabeans, etc...
Very little questions about security, servlet API and patterns.
I used the SCWCD book from Manning, but found a lot of errors, and
it didn't cover everything. Especially, EL was not enough. And configuration settings in WEB.XML. For instance, i had a question about welcome files, and one about EJB configuration in the web.xml, but it wasn't in the book. Also the use of variable in the tld, wasn't explained in the book.

Grtz,
Chris

SCJP and SCWCD
Manish,

I did my exam today (successful).
Be sure to study JSTL tags and EL. I had not many questions about
the servlet API, a lot about Tags : classic tags, simple tags and tag files...

I used the book from Manning (new edition), but i found a lot of errors in it and i got 5 or 6 questions about the web-xml that were not even mentioned in the book. So if you are using that one, be sure to study
Web.xml and El's more using sources on the web.

Good luck,
Chris.
Hello Selva,

Indeed, the useBean is ended, with />, but that only means that the
setProperty is always executed. If it was in the useBean tag,
then it only be executed if the class was not found in pageScope and was created as a result of that.

Or are you saying that the setProperty can only be used in the body
of the useBean ?

Grtz,
Chris.
Selva,

This is my own interpretation, but i wouldn't think so.
If the container can find the tld, it knows where to find the class (<tag-class> in the tld). Wether the class is located in the jar or in the classes dir makes no difference. It uses the classpath to find the class, and both (web-inf/classes and jar files) are autmatically put in the path when the container starts up.
I do not agree on this one.
using the property='*' means that all the parameters are taken and mapped on the setters of the object. As, in this case the String object has no
setHello() method, nothing happens, and we remain with an empty string.

Chris.
I think 5 is not correct.
The uri is only a string to map a location.
There is no link between the uri and the location.
The tld must be under the WEB-INF or if in a jar, it should be under the
META-INF directory. That is where the container looks to create his taglib-map that contains the all the uri-location of the tld's.

where did you find this question ?

Grtz,
Chris.
Hello,

I'm studying for the SCWCD exam and i'm a bit confused about the following :
Can someone tell me the difference between :

JspWriter wrt = getBodyContent.getEnclosingWriter();
JspWriter wrt = getPreviousOut();
JspWriter wrt = getPageContext.getOut();

in the doAfterBodyMethod of a class extending the BodyTagSupport.
Doesn't all the 'wrt' write to the same output ?

Tnx,
Chris.
Hello, I've copied the exampel beneath from 'SCWCD exam study kit second edition' (Manning)
We try to pass a boolean to the tag class.
In the 'attribute' definition, no <type> is given, so the class expects the default, being a String.
Altough , the setCondition expects a boolean as parameter.
That leaves us with 2 possibilities :
1. they forgot the <type> attribuut in the defintion of the attribute and it should say : <type>boolean</type>
or
2. "<%= debug %>" returns a String and the tag class does the conversion to boolean before the setCondition is called.

If 2 is correct, what's the use of <type> than ?

definition of the tag
<tag>
<name>if</name>
<tag-class>sampleLib.IfTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<name>condition</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>

code of the tag class
public class IfTag implements Tag
{
//other methods as before
private boolean condition = false;
public void setCondition(boolean condition)
{
this.condition = condition;
}

public int doStartTag() throws JspException
{
if (condition)
return EVAL_BODY_INCLUDE;
else
return SKIP_BODY;
}
}

jsp code
<%@ taglib prefix="test" uri="/WEB-INF/sampleLib.tld" %>
<% boolean debug = "true".equals(request.getParameter("debug")); %>
<html><body>
Hello<br>
<test:if condition="<%= debug %>" >
DEBUG INFO:...
</test:if>

pls help, as my exam is comming up
try putting a blank between the start and end tag.
17 years ago
JSP
1How did you display data in your jsp?
Using expressions, or tags (JSTL), or custom tags

2 when do you use ArrayList and LinkedList?
LinkedList : keeps the order of objects

3 would you prefer database code in application server or in stored procedures in database server? what are the advantages and disadvantage?

I could write a book about this. I would prefer in the DB, so other non-java applications can use the same code.

4 Objects takes parameter by pass by reference then why String Object takes oparameter by pass by value? -> strings are immutable.

5 why would you do clientside validation? what are the advantages over serverside validation? -> faster response.
17 years ago
JSP
Hello,

I'm studying for the SCWCD exam and i'm a bit confused about the following :
Can someone tell me the difference between :

JspWriter wrt = getBodyContent.getEnclosingWriter();
JspWriter wrt = getPreviousOut();
JspWriter wrt = getPageContext.getOut();

in the doAfterBodyMethod of a class extending the BodyTagSupport.
Doesn't all the 'wrt' write to the same output ?

Tnx,
Chris.