John Stone

Ranch Hand
+ Follow
since May 04, 2007
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by John Stone

from javaserver_pages_2_1.pdf spec.

JSP.7.1.11 Resource Injection

A JSP container that is not part of a Java EE technology-compliant
implementation is encouraged, but not required, to support resource injection.
Resource injection is not supported for JSP pages or tag files.

Note, that tag handler and event listeners are supported.
I think, that you have no other choice but to use JNDI in JSPs.
EJB 3 in Action, page 440. - there is a table on top of page, which lists JSPs and helper classes as non-managed, and therefore injection doesn't work for them.
I'll try to find this in ejb core spec. to confirm it.
I think, that every time look up Item via JNDI you end up with new instance.
Consider this text from ejb core spec, page. 74-75

A session bean instance’s life starts when a client obtains a reference to a stateful session bean
instance through dependency injection or JNDI lookup, or when the client invokes a create<METHOD> method
on the session bean’s home interface. This causes the container to
invoke newInstance on the session bean class to create a new session bean instance. Next,
the container injects the bean’s SessionContext, if applicable, and performs any other
dependency injection as specified by metadata annotations on the bean class or by the deployment
descriptor. The container then calls the PostConstruct lifecycle callback interceptor
method(s) for the bean

So what I think you should do is to store the reference to HttpSession as attribute and use it in subsequent requests to your servlet.
Hello rangers,

I found this code on page 330 of EJB 3 in Action:

I'm concerned about efficiency of this code. As I understand it, all items of seller are fetched from DB, and all items of categories are fetched from DB, then made into java classes, some change is made to them, and then again they all need to be saved to DB.

Is this really how it works behind the scenes?
Is there any better way to delete these items more efficiently? I know you can write your own query, but then what's the point of having JPA?

Thank you.
Thanks, I thought it works automatically in both ways.
I came across this paragraph in "EJB 3 in action"

Isn't entity managed after line 'entityManager.persist(item);'?
If it is managed, it should automatically synchronised with db, right?
Then why is there need to call 'refresh'?
Is the following sentence true or false?
"This sentence is not true."
15 years ago
I believe it is Java related, because you would face the same problem on any machine/OS with multiple interfaces. My guess is, there is something similiar like there is java.rmi.XXX to specify your address if you are behind a NAT.
15 years ago
I downloaded java application (SIP Communicator - SIP soft phone) for Windows XP. This application seems to be trying to get local IP address of some interface, which is later used in SIP INVITE messages in "Via" header. I have multiple network interfaces installed on my pc, e.g. vmware, pcmcia, and this seems to be problem, because it chooses wrong network interface.

Is there any way how can I enforce my local IP address, or which network interface to use? Some property, which I can set, or some settings I can change? So far my only solution was to disable all interfaces, except the one I wanted to use. Also control panel->network connections->advanced->advanced settings doesn't have any influence.

Thank you for any hints.
15 years ago
thanks for the tips on books,
now I just have to worry that by the time I finish my study of ejb3 there will be new version released :-)
I took your code, removed <servlet-class> element, accessed the page via / and I can see init params.

Very nice, congrats.
15 years ago
I just returned from prometric testing centre with a nice number (94) on my exam report. I started my preparation about 6 months ago, I used HFSJ first edition, Marcus Green's web, notes from Mikalai Z., and specs. I read HFSJ multiple times - I had no previous experience, so I was confused :-)

Mocks I used:
Marcus Green mocks
- easier than real exam, some questions have bugs - 90-95%
- nice page, my first hard exam resulted in 65%, final mock in 91%
- I learned a few tricks here

Enthuware JWebPlus v4
- 88%, 82%, 91%, 81%, 89%, 89%, 78%
- few questions are wrong, but otherwise it's a nice collection of mocks


- time is on your side
180 minutes is a lot,.. I wouldn't worry about time. I filled all answers in 90 minutes, then checked all of them in 30 minutes.

- Homer's epic poem
Some questions are lengthy, but that should not scare you. Sometimes it's only introduction to a problem and in the end is a question like: "Which of these will compile?" - you could answer that without knowing how some anonymous company obtained their legacy tag library, right? :-)

- mark the answer with familiar syntax
Usually it's not that simple. I saw mocks where they ask you, which syntax is right and then presented a few completely different choices. Be prepared, that choices on real exam will look very similar. So, it is always a good practice to read all choices, and if you didn't mark some choice try to answer why is it wrong.

- I've seen it all before
That's what I thought after I went through ~500-700 mock questions. Well, I was wrong. After first question I thought I'm on wrong exam, because it was some insanely hard deployment topic - the one with a company and legacy library/tag/code, so I was afraid, that all of them will be like that :-).

- public void doExam() throws javax.servlet.Unexpected
more classic tag questions than I expected
tough deployment questions - and I don't mean DD tags questions
only 3 drag'n'drop questions

You should be familiar with API, which are interfaces, which are classes, what methods, return types, parameters, exceptions are there.

Overall, I think exam is balanced, it tests if you have solid understanding on topics, and there are (almost) no questions on some picky details, which are mentioned only in dark corners of specs.
[ May 23, 2008: Message edited by: John Stone ]
15 years ago
You only need 083:
Sun Certified Web Component Developer for the Java Platform, Enterprise Edition 5 (CX-310-083)

This is for people already having 1.4 cert, who wants to upgrade it to 1.5