This week's book giveaway is in the Testing forum.
We're giving away four copies of Data Structures the Fun Way: An Amusing Adventure with Coffee-Filled Examples and have Jeremy Kubica on-line!
See this thread for details.

Jan van Mansum

Ranch Hand
+ Follow
since Oct 19, 2007
Merit badge: grant badges
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 Jan van Mansum

Raf Szczypiorski wrote:And they could even throw exceptions when you try to invoke the forbidden setContextClassLoader() if they are implemented that way.



I was going to ask you how, but after a brief look at the Thread API, I can see that all they would have to do is set some security properties or override Thead.setContextClassLoader(). That leaves me in a fix. Some of the libraries that I call from my OSGi plug-in use the context class loader to load some of the classes they use. The context class loader is the one set by JBoss. On the other hand the class I need those libraries to load are in the OSGi-provided classloader (the current classloader at that time). Anyway, that's all a bit off-topic on this forum. I am now in the clear about this point for the exam. Thanks.
Hi group,

I am preparing for the SCBCD 5.0 using Zaikins document. Under "Identify correct and incorrect statements or examples about EJB programming restrictions" he specifies a lot of restrictions. My question is: what is the container supposed to do about it if the EJB doesn't comply? I'll give an example. I am writing OSGi plug-ins for a framework that uses OSGi embedded in an EJB that is deployed to JBoss AS. The only way I was able to solve certain class loader problems was by changing the context classloader to the current class loader at the start of my code and setting it back before my code returns. JBoss doesn't complain about it. I don't see how it could even detect it. Anyway, apparently I violated some JEE rule, but I am not totally convinced it is bad. The only thing that slightly worries me is that it might break in some other container than JBoss.

Thanks for any help,
regards,

Jan van Mansum.

Originally posted by subhadra kankipati:
Hi...

Planning to take scjp exam. But in a dilemma whether to take 1.4 or 5. Since 1.4 is much easier and something that i know part of me says do it. but at the same time feel like doing 5 so that i can learn the new concepts. I have no prior experience except programming in college which was 3 years back. What should i do somebody please suggest.



I remember this one was asked previously. I think it should be a FAQ Someone responded very aptly: how are you going to explain in a job interview that you took the older exam? Surely, you would say: I just wanted the easier one.
I am not completely sure what you mean, but have you considered making your threads daemon thread. This will keep them from keeping your process alive.

See: Thread.setDaemon
14 years ago
Those are the extensions for JSP files and tag files in xml syntax. As you may know there are two alternative syntaxes for JSP: the traditional one (using <% %> for scriptlets, for instances) and the XML variant (using <jsp:scriptlet>
</jsp:scriplet> . ). There are several ways to configure your web container to treat files as documents (XML) instead of traditional syntax files. One of those (for JSP 2.0 and higher) is to give the extension .jspx and .tagx for JSP files and tag files respectively. See also this thread.
[ December 04, 2007: Message edited by: Jan van Mansum ]
This was something I never completely understood myself. So the answer is: both, there is a copy on the stack and a copy on the heap (as field of the method local object).

Interesting links Nico Dotti. Thanks
The API
makes for interesting reading :


The current thread must own this object's monitor. The thread releases ownership of this monitor and waits until another thread notifies threads waiting on this object's monitor to wake up either through a call to the notify method or the notifyAll method. The thread then waits until it can re-obtain ownership of the monitor and resumes execution.


(my emphasis)

Hope this answers your question.

Originally posted by Sandeep Krish:
This is were you read it.



In the tag library descriptor file (the .tld file) the body-content element is mandatory. You are referring to the body-content attribute of the tag directive in a tag file. This attribute defaults to "scriptless" and not "JSP", by the way. "JSP" is not even allowed, as tag files are translated to tag handlers implementing the SimpleTag interface, which disallows body-content "JSP".

Please refer to JSP 2.0 specs Figure JSP.C-3 (p. 3-17) and Table JSP.8-2 (p. 1-180).

Originally posted by ruquia tabassum:
correct options are a and d coz body-content default value is JSP. If body-content is not present it considers it to be JSP.



That is not correct. The body-content element is mandatory; there must be exactly one in every tag element.
First, I think the title of your post should be "Interfaces, why do we need them?"

Second, you should declare that Class1 implements MyInt, otherwise you will not be able to assign an instance of it to a the "abc" reference, which is of type MyInt.

I think interfaces are mainly intended to allow the programmer to limit dependencies between different parts of his code. For instance if I write a sort method I can write it to take an instance of my special list class as an argument:



But I could also declare an interface List which exposes all the methods that I need to carry out the sorting and write a method that takes an object of that type:



Now my sort method is not dependent on MySpecialListClass. I only need to make sure that MySpecialListClass implements List.

I have changed the dependencies from



to



This means, for instance that I can change and recompile MySpecialListClass without recompiling the module that contains sort.
15 years ago
It is very strange that your EL expressions are treated as template text only after you submit your form. I would expect them to be treated as such always or never, but not "sometimes".

Anyway, I can see what you are trying to do and it will not work. You have declared a field in your JSP-page (or the servlet that is generated from your JSP page) and you want to retrieve its value in an EL expression. EL however requires variables that are attributes of one of the four scopes: page, request, session or context.

Also, it is usually not a good idea to use servlet instance variables, as they can be accessed and changed by multiple clients.
You should do SCJP 5. It is the latest version of the exam. In a year or so 1.4 will look rather outdated. That's why I am preparing for my upgrade exam.
You need the certificate with which your signed jar files were signed. You cannot sign your jar file with a signed jar file. That would defeat the purpose of signing, as it would mean that you could download a jar file signed by say Sun Microsystems and then create your own jar files---containing, say, a virus---signed by Sun Microsystems.

Are you creating an applet, a Java application deployed by WebStart or something else?
15 years ago
Looks like you are working on Windows, but your are using a Unix-style path in your classpath argument to javac.
15 years ago