Ad Tan

Greenhorn
+ Follow
since Oct 30, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Ad Tan

I was trying if Java EE can "Magically" do all these... I guess it's not there yet... Prob have to do the EAR file

BTW, do you know if I can use global JNDI for these to work?
13 years ago
Hmm... after reading up on CDI... I added beans.xml to my WAR file, and everything works, even without the "Depends" workaround.

I guess we're learning a little every day!
13 years ago

Jaikiran Pai wrote:The @Inject should work fine.

Well, that's what I thought, but it doesn't work. Not even in GlassFish.

So I'm guessing it doesn't work in JEE6.

To clarify a little, here is how they are deployed:
13 years ago
I have multiple WAR files, which read the same EJB (contained in a JAR file). These WAR and JAR files are all separately deployed in JBoss AS 6 (ie. not within the same EAR file).

Is there a way where I can access the EJB via CDI (such as @Inject) from my WAR file?

For example, my EJB:
My consumer in the WAR file:Anyone know if this is achievable? Or do I have to do it the initialContext.lookup() manner?

Thanks, Ad
13 years ago
For my case, it is not really whether multi-tabs should be available, but my concerns are with unknown behavior, there might be potential security issues, ie, users may be able to make use of multi-tab to access entities that are normally unavailable.

Anyway, to resolve this issue, what I have done is to provide the following:
1. Use a commandButton instead, which prevents opening new tabs (hopefully, haven't test which browser plugins still allows that)
2. Use a commandLink but change target to "_blank", thus forcing a new tab/window.

Ad
13 years ago
JSF
Hi all,

I'm using JSF2 and I have pageA and pageB, where pageA have a table where each row is a record, let's call it entityX.

When a record is selected via commandLink, the details can be viewed in pageB.

So the details are displayed in pageB via MBeanB...

Normally, this approach works well. However, if I choose to open the link in a new tab/window, it will open pageB directly without going through the select method in MBeanA. My question is, how can I change the commandLink to always go through the same workflow, regardless if the target is the same window or a new tab/window.

BTW, I can't use commandButton for some reasons... and my users require multi-tab functionalities.

Thanks!

Ad
13 years ago
JSF
According to the documentation, for JBoss 6 m4 and above (i'm using final). There should be no need for any configuration (ie. web.xml) for EJB and CDI to work. So why should this fail?
13 years ago
Hi folks,

I was trying out JBoss RESTEasy on JBoss AS 6 (final), and surprisingly, it is easy to get my first RESTful web service up and running...

Basically with zero configuration (no web.xml), and a simple hello class, I could get it running:

Next, I attempt to inject an EJB by using the @EJB annotation. However, I receive a RuntimeException: javax.naming.NameNotFoundException : local not bound.

Using the usual lookup method got it working though.

I tested the same EJB with a servlet in the same web app, and it worked without a prob.

Anyone knows why it couldn't work with the @EJB annotation?

Thanks in advance.
13 years ago
Well.. if I could do the application all over again, then i'd prob think to something better from ground up. Too bad this project is nearing it's end.

Tentatively, I have resorted to using a hidden input initialised with the correct POJO's id. In the backing bean I'll do swapping if the submitted form does not have the same id as the current POJO. Not sure of any drawbacks... needs to test further.
14 years ago
JSF
I'm in sort of the same problem here...

Seems to me that using a backing bean (of session scope) is a very popular way of JSF development. Many examples are based in this method. Let's revisit the following actions in a classic CRUD use-case using this method:

1. Enter a listing page in tab A
2. Open a new tab B and enter the same listing page
3. Select tab A and edit a record X (which opens a form)
4. Select tab B and edit a different record Y (which opens a form)
5. Make changes on tab A and commit

By step 4, the backing bean is already referencing POJO of record Y, and making changes on tab A is based on record Y and not record X as initially loaded.

I was wondering how is this scenario typically handled, any ideas???

Ad
14 years ago
JSF
I have found the solution to both my questions.

The reason why things do not work is, the guy previously working on this project added a JS prototype class with the name "Node", which somehow conflicts which RichFaces.

After renaming that "Node" class to something else, my oncomplete could work.

Based on this, I could use directly get my bean value out with my oncomplete method.


Thanks for all the help...
14 years ago
JSF
Alright... so if my action method returns something, oncomplete doesn't work.... and also, there is no change of my presentation layer directly receiving the return value???

However, I have tried oncomplete on an action method that returns void; and it doesn't work as well.
14 years ago
JSF
Hi all, I am quite new to JSF... and have the following question (I've tried search).

I am using RichFaces' command button to send an (AJAX) action to a managed bean:

Assuming my perform method in the managed bean returns a string, how can I get the value out?

Side track abit... I'm using onbeforedomupdate because oncomplete does not seems to work (on RichFaces 3.3.2), any ideas?

Adstan
14 years ago
JSF
Hi Katreena,


The 48-hr rule refers to an optional requirement specified by by UrlyBird assignment. If you have not download and read the assignment, it'd prob wouldn't mean anything to you.

As for books... Javaranch is my one and only BOOK!!!

Whenever I had queries, I usually just do a search... half the time, I will get too OVERLOADED with results.. haha.. that I do not know which I should choose. But, too much results is much better than some forums that have too little results.
14 years ago
Thanks for everyone in this forum that has helped greatly, I have passed my SCJD with 379/400.

General Considerations 90/100
Documentation 70/70
O-O Design 30/30
GUI 29/40
Locking 80/80
Data store 40/40
Network server 40/40

Lost 11 pts in GUI... probably because I used dialog for many functions, instead of a all-in-one frame.

Anyway, I'll be glad to help in any design considerations...

Some of my designs if it helps:
- All my locking were done via business layer, client code does call lock/unlock methods.
- Usage of RandomAccessFile to read/write the data.
- Implemented the 48 hour rule option
14 years ago