Pravin Jain

Ranch Hand
+ Follow
since May 20, 2007
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 Pravin Jain

Originally posted by Sam Bluesman:
OK. Let me start again.

Here is the code (slightly updated than before)



This is the html applet tag:

<applet code="org.me.Program" archive="HelloApplet2.jar"/>



The output of the Java console is:

java.lang.NoClassDefFoundError: org/jdesktop/layout/GroupLayout$Group
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


I have the layout extensions library containing the jDesktop library in the libraries directory of the Web Application (shown when using the Project view) and I also have it as part of the Libraries directory of the project I initally created the applet in.

Any ideas?

Thanks

[ October 01, 2007: Message edited by: Sam Bluesman ]

[ October 01, 2007: Message edited by: Ulf Dittmer ]



keep the jar in the same directory as your html file.
11 years ago

Originally posted by Bear Bibeault:
On the client or server? Do you know how you would validate a single such entry? What code have you written so far?



The validation is required on the client side using javascript.
I have a form with several input fields. one of the fields is
for accepting multiple email addresses, one email per line. I
need to check that each line contains a valid email address.
The field may be left blank, but if there is any entry then it
should be a valid email address.

I have got a regex pattern which can validate a single entry.
The regex is as follows:
/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i

will it work if I simply group this regex as follows:
(/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i)*



Thanks
Pravin
[ October 02, 2007: Message edited by: Pravin Jain ]

Originally posted by Jose Campana:
Hello Fellow Ranchers,
I'm having an issue with knowing how class access works when classes are in different packages.
The question I have is:
If I have an interface in one package(app.pack1), and that interface is public:

And I have a class that implements the Interface in another package(app.pack2).

Why do I have to import it(import app.pack1.MyInterface...) If the interface is public?

Could someone please explain to me these basics about packages?

Thank in advance,

Sincerely,
Jose




It is not necessary to use import in order to use an interface or class from a different package. One can use a public class or an interface from any package by using the fully qualified class name.
So in a java file an import statement is simply a declaration of a shortcut
to indicate that you would like to use the class name alone instead of the
fully qualified class name through out a given java file.
11 years ago
How do I validate multiple email addresses entered in a textarea.
one per line in the text area.

Originally posted by Ulf Dittmer:
The Servlet FAQ links to articles explaining the differences between Servlet API versions. It also links to the SpecificationUrls page that has links to all kinds of specifications.



Do we have a final release for Servlet Specifications 2.5?
The link at sun always reads as maintenance mode.
11 years ago
The Servlet Specifications 2.5 is being displayed as mainytenance mode
there is no final release of 2.5.
I believe Tomcat 6 is based on servlet specification 2.5.
Where can I find the final release of servlet specifications 2.5 and
what are the changes from 2.4?
11 years ago
binding to application is setting attribute for the application scope.
i.e. something like.
application.setAttribute("firstPartOfURI", Util.getFirstPartOfURI(request));
12 years ago
JSP
The answes c & d are correct.
a is not currect, as can be verified from the apis.


"static variables are not saved during serilazation "
means is it just like a transient ?


static variables are not like transient.
Since transient variables are part of the object and can be
persisted(saved) using the custom serialization which
can be provided for instances of a class by defining
a writeObject(ObjectOutput oo) method in a class.


Note: join() throws IllegalStateException, so handle that exception.



it actually throws InterruptedException and not IllegalStateException
and you need to handle in the run method.
even if you commnet the line to readObject the value of i
would still be 20.
so think whether i was persisted in the object?
I would go with your first option. ie. use the inner class as a special case
for ONE, since you still want to allow mutability for other instances.
12 years ago
have a look at
java.net.URL and java.net.URLConnection
12 years ago
There is a mention of SoftReference being used for this purpose.
pl. refer java.lang.ref.SoftReference and java.lang.ref.ReferenceQueue
12 years ago
Observer and Observable are a pair of interface and class
in the java.util package to implement a general purpose
Observer pattern. something similar to the event delegation model.
Observable is any Object on which Observers may be registered
and which notifies the registered Observers about the changes
taking place in the state of the Observable.
Observer is an interface which is used for implementing
the action to be taken when the update is taking place on the
Observable.
12 years ago