mini mehta

Ranch Hand
+ Follow
since Oct 22, 2000
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 mini mehta


Is there any way to call java code from non-java and return a exit code from java program to non-java program.

example calling a java batch program from a shell script.

17 years ago

Originally posted by Bear Bibeault:

Because HTML doesn't work that way. There is no meand to put the byte data directly into an HTML page and then expect theimage to show up. You must make a spearate request through an <img> tag.

JSP isn't any kind of magic that will make HTML do anything it can't do outside of JSP.

I never said html img will do it. I mean writing a custom jsp which has access to every object as servlet like OutputStream.
18 years ago
I have already done that by creating a Image Servlet. But what i don't understand is why can't u do it through a tag. When you can have a iterator tag which accepts a Collection object, then you can always accept a byte array too.
18 years ago

Does any body know of any custom tag for rendering image using a byte[]

i,e something like

<imagetag image="<%=form.getBytes() %>" height="<%form.getHeight() %>" width="<%form.getWidth() %>" />

18 years ago

The spec says that the get method of CMR field's should return Collection or Set. I am hoping that means any subclass of Collection or subclass of Set. So returning a List object should be OK, assuming the get method has declared return type as Collection or Set.


Originally posted by Nigel Browne:

The class object has no Class attributes and it never has had.

What about String.class or StringBuffer.class?
19 years ago

Does anybody knows when the "class" - an Class attribute was introduced in "Object" class? Even though "class" attribute is part of the "Object" class, it is not part of javadoc, is there any reason, why?

19 years ago

Originally posted by Giju George:
A stateless session bean can call the EJBContext.getUserTx() in the ejbCreate() and ejbRemove(). But, then why can't it NOT invoke the user tx methods there ???

It can't call the Container managed transaction because the during these methods, container doesn't have a valid transaction. But u can create your own transactions using EJBContext.getUserTransaction();


In a stateful session bean's ejbActivate and ejbPassivate, we can call getCallerPrincipal() and isCallerInRole().. where as we cannot do the same in entity bean's ejbActivate and ejbPassivate...........
WHY ??

After ejbPassivate the entity beans goes into a pool state, that means it is not attached to a client and similarly when ejbActivate is called bean is in the pooled state and hence no client.
[ July 07, 2004: Message edited by: Giju George ]
According to the spec page 374

The Container catches a non-application exception; logs it (which can result in alerting the System
Administrator); and, unless the bean is a message-driven bean, throws the java.rmi.RemoteException
(or subclass thereof) to the client if the client is a remote client, or throws the
javax.ejb.EJBException (or subclass thereof) to the client if the client is a local client. The
Bean Provider can rely on the Container to perform the following tasks when catching a non-application
� The transaction in which the bean method participated will be rolled back.
� No other method will be invoked on an instance that threw a non-application exception.
This means that the Bean Provider does not have to perform any cleanup actions before throwing a
non-application exception. It is the Container that is responsible for the cleanup.

[ July 01, 2004: Message edited by: mini mehta ]
Giju, you are right. As per the spec it should throw NoSuchObjectException.

So the statement is HFE is wrong.
some body should have answer for this.
19 years ago

I am able to get to the correct forward page from my Action Class, but the problem is the URL shown on the browser is the path to the my Action Class in the struts config

i,e http://blah.blah/do/MyActionServlet

I was expecting it to show http://blah.blah/common/tools/AdminScreen.

As I said above even though the page i see is the correct one but the URL is still the do Action. Is there any way to actually show the right URL.
19 years ago
Thanks Suman. I believed what you said in the answer until I saw this answer in HFE with an explaination. But thanks for confirming the fact.
Well but if you look at HFE 672 Q46, it doesn't thinks "Primary key fields must be cmp-fields"

Originally posted by pervaiz gul:
I am confused at the Q-9 in the chapter entity bean Synchronization.
Question: Which methods from the EntityContext interface can be invoked from within the ejbCreate method?
The answers in the book are getEJBHome,getEJBObject, getCallerPrincipal and setRollBackOnly.
BUT my question is how can getEJBObject be invoked in ejbCreate? i think there is no EJBObject until ejbPostCreate...
can anyone plz explain.


You are correct, the answer is wrong, it should not have getEJBObject() method