Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Some General Questions.

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is going to be long one..
I intend to use java to write an application or applications which would enable my clients to access their data (in my database) and modify it.
I am currently using Cold Fusion and CGI to do this. This works OK but the Annoyance factor is really high. Some validation of the data can be done easily with Javascript (like if they specify information VIA fax then they should give a fax number) other validation is impossible with Javascript like did they type in a valid county in the format "county, St" (There are over 3000 counties in the US).
If the client does not know the county that a city belongs in then there must be some sort of a helper lookup.
I have decided that Java might be the right way to go but I have several questions which I hope you can answer.
here they are in no particular order.
1) If I develop with one JDK (say 1.2) will that mean some users won't be able to run my applet?
2) What JDK should I use enable the widest distribution possible.
3) Is there such thing as browser indepenence with java or do I have to say Netscape users go here IE go there.
4) Can I make an applet have the users download it their hard drive so that they won't have to wait so long till it loads.
5) Can use servelets to run my queries and pass recordset objects to my applet? Will this take a long time with a modem. Is RMI prefered? (I am presuming that all heavy database querying should take place on the server).
6) Is it possible to use a combination of Javascript and Java
7) Is java able to interact with the browser like javascript? Can I set a cookie with it?
8) Is it stable and secure enough to trust my business with. Will it make my tech support harder or easier.
9) Is it possible to encapsulate my business logic in a DLL and then call it using a servelet? This way the local users and the web users would be using the same code.
10) what if I made an ActiveX object instead of a DLL.
11) What if I loaded my object in the Microsoft Transaction server?
12 How about the reverse. What if I made my business logic a set of Java classes can I call them from my VB app? Can they pretend to be ActiveX objects?

I guess I am trying to determine if Java will do the Job before I invest all this time to learning it.
Adthanksvance Tim.

 
Trailboss
Posts: 23866
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is cold fusion?
1) Maybe. I know there is this whole new plug in thing that I don't fully understand. I know what a browser plug-in is, but I don't know if older browsers can run applets in them, since they have a built in Java.
2) For applets? 1.0. I would try to avoid applets if possible and use servlets instead. Rather than using county name, I think all zip codes do not cross county lines, so have them use their zip code and have the servlet fill in the county.
3) Yes you can have browser independence.
4) Yes, you can have your users download the applet to their hard disk and run it from there.
5) Rather than have servlets send data to applets (which is no big deal) I would rather use CGI and avoid applets.
6) Yes, you can combine Java and JavaScript. These are two unrelated languages.
7) Java talking to JavaScript: dunno, have never tried. I'm pretty sure cookies can be done from Java although I haven't tried that either.
8) Java is more stable and secure than any other language I know of and it will make your tech support much easier. Although applets add a definite ick factor. (IMO)
9) I know the JNI stuff allows Java to access "native" code - not sure about the details.
10) dunno
11) dunno
12) dunno
Nine out of twelve ain't bad.
I think this type of forum does not lend itself well to big messages. Maybe break them up a bit more next time.
 
Tim Uckun
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok i'll break it a little.
Cold Fusion is like ASP. It is also probably like servelets (If I am understanding servelets properly). It runs on the server and returns pure html to the browser. I really wanted to avoid this by using java. Each submission to the server takes a really long time and most validations end up taking several forms to complete.
 
Tim Uckun
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why applets.
I wanted to use applets so that anybody can come to my web site and start working. I did not want to make people download and install a bunch of stuff (mainly because they are shall we say technologically challenged). Also as the application evolved the users to the application would allways be using the latest version. Same with bug fixes.
 
paul wheaton
Trailboss
Posts: 23866
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you make your users download a copy of an applet to their hard disk and use that applet, they might not get the update when you provide one without having to hassle them.
Suppose they downloaded an applet to their hard disk and used that. Your applet reference will no longer be to your service:
www.eporkchop.com/myapplet.jar
but something like
c:\mystorage\myapplet.jar
So you could try
C:\mystorage\myapplet5.jar
and the next version would be
c:\mystorage\myapplet6.jar
The user would get a message about how the applet was not found and they would need to download an update.
 
Tim Uckun
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Seems kind of convoluted to do that.
Is an applet the only way to make sure the client is using the latest version of code? Can I write a program (not an applet) that can load classes from my server?. Maybe just a tiny stub of of a program which then loads a series of classes to make sure that the latest version of the code is being used. Would that make any difference at all? I guess I need to understand the differences between a regular application and an applet first. Seems like I am getting ahead of myself.
 
paul wheaton
Trailboss
Posts: 23866
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
An applet is a program that runs in a web browser.
An application is a program that runs by itself (no browser).
I suppose it would be possible to write a program that will always update itself. You could just open a socket to your server and say "hi! I'm version 2.11.2. Am I the latest?" And if the answer is no, the program can download a whole new copy of itself.
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, I have what may seem like an odd suggestion for this, but it's an approach which I have used very successfully in a prototype system. Although currently shelved, the aim of our project was to automate distribution of a fairly complex client/server system to a variety of clients (mostly handheld WinCE boxes, but some laptops). About 20000 client systems in all!
The trick I discovered while producing the architecture for this is to use Java servlets - but on the client! Here's how it works:
Each client has a JVM, capable of running application code, and a generic browser (which doesn't necessarily need Java support). To "bootstrap" the system, connect the client to a network and download a very simple Java web server (I wrote one which serves files and runs servlets in well under 40K of classes). This is the basis of the solution.
Now all you need is a few servlets. The first one to write is one to scan a file or directory on the client, and gather the version numbers of all servlets on the client; contact the software host system and download any updates or new data files. The rest of the servlets are application specific, but include form processing and input verification etc.
The cunning thing about a system like this is that a lot of input verification which would otherwise require immediate (applet or JavaScript) verification can be done by submitting a form to a servlet. Because the form is only submitted *to the client* and never travels over the network until it is finally ready, response can be very quick. Of course applets and JavaScript can also be
served by the server-on-the-client if required.
I hope this made at least a little sense. To explain it to people here I have a set of diagrams, but they're a little difficult to fit into this text box
If anyone is interested in this approach, feel free to reply here or contact me directly.
Frank.
 
paul wheaton
Trailboss
Posts: 23866
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I read your message three times.
Why servlets? Why not just apps which can use a socket to test if they are the latest version and transfer a new copy of themselves?
 
Tim Uckun
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Very interesting. Isn't java able to dynamically load classes? What I was planning on doing was to have a stub applet or application that would download a JAR file from my server if the name was different. I.E if the locally saved Jar file is called myjar1.jar and the server is called mayjar2.jar then download the jar2 file. I am still confused about the whole applet application servelet thing somewhat though. Is it possible to do RMI or CORBA from inside a browser?
 
paul wheaton
Trailboss
Posts: 23866
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, RMI and CORBA can be done from within a browser. In fact, Netscape contains the Inprise CORBA ORB.
 
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is possible to use a combination of Javascript and Java. Want details?
[This message has been edited by Michael Finney (edited February 04, 1999).]
 
Michael Finney
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to clear up the application vs. applet thing using as few words as possible.
Applet uses the JVM that is in the browser. It runs in the browser. An application uses the JVM that is installed on the machine.
The code to run on a browser is a little different; start(), stop(), init(), destroy() are called by the browser when the browser thinks it is time to do so.
In an application the
public static void main() function of the called class is called.
 
Michael Finney
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From JavaScript: The Definitive Guide (3rd Edition) by O Reilly.
"...as of JavaScript 1.1, Navigator and Internet Explorer both allow JavaScript programs to read and write the public fields and invoke the public methods of Java applets embedded in an HTML document." IE works with the applet "as a type of ActiveX control and uses its ActiveX Scripting technology to allow JavaScript programs to interact with the applet." The book doesn't cover how to do this. It refers you to the microsoft website.
"Navigator supports JavaScript interaction with Java applets through a technology known as LiveConnect." Using LiveConnect, interaction between Java and JavaScript is possible BOTH ways. The book says it is easy to accomplish difficult things using it. It can even work with Java-enabled Navigator plugin, built in browser Java classes and more. I think all that is Navigator specific. All the above is from pg 355.
JavaScript can give you more control over the browser window than Java can, but of course JavaScript "cannot draw graphics or perform networking." "Java has no control over the browser as a whole but can do graphics, networking and multithreading." (pg 2)

[This message has been edited by Michael Finney (edited February 04, 1999).]
 
Tim Uckun
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mmm very interesting. I have that book I should read those chapters closely to see if there is a way I can implement what I want. This explains why micro-soft remote scripting is flakey with netscape. Also I have heard that the Macintosh version of IE4 does not allow this javascript to java interaction. Personally I think there is a huge potential there. It would be cool to build a really small app that connects to an orb and acts as a proxy for your javascript function. Too bad there are so many different implementations of javascript. I would hate to tell my users to use a specific browser because they would all want to use IE.
PS. I have a couple of posts in the micro-soft remote scripting thread about this subject. Maybe we could reorganize the forum to create a scripting and java thread.
[This message has been edited by Tim Uckun (edited February 04, 1999).]
 
Michael Finney
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Truly. Java talking to things on the internet makes sense to me. Javascript controlling the browser window makes sense to me. Javascript talking to an orb does not make sense to me.
However, this brings me to my next thought and question...
[This message has been edited by Michael Finney (edited February 04, 1999).]
 
Michael Finney
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think Tim Uckun understands when I say...
I want a book. This book would be up to date with JDK1.2 It would explain the things you can only do (or can only do easy/well)in Java. I'm sure something in this book would discuss dynamic loading of Java classes and keeping aplications/applets current.
This book would also discuss how to REALLY make network centric applications and why we would want to do such a thing in the first place.
I want a book that says "this is why Java is best for the following things".
I want the material that says this is what you require to make things work over the internet, it's easy, and people anywhere with a browser can access it.
I want to see the bigger picture. I've seen java.lang and java.awt.* with swing. I require more. I want things which will stimulate my thinking and assist me in developing those things that people need and might not even know it.
That's my thought process. I want a book.
 
Tim Uckun
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree. A bigger picture is warranted. Not just java the whole thing. It seems to me that everybody is trying to do the same thing. Run code A in server Y return result to code B in machine X. Should be a simple thing really. Instead of some standard way of achieving this there are a dizzying number of technologies and solutions. DCOM, RMI, CORBA, ActiveX, EJB, Servelets and all kinds of transaction servers and assorted middleware products. Not to mention the front end where you can take your pick from pure HTML, ActiveXforms, Java app, Java applets, and just plain old VB/DELPHI/C++ applications. When I was a car salesman (a long long time ago) my sales manager used to be fond of saying "throw enough shit on the wall and some of it's bound the stick". It seems to me that's what SUN, M$, IBM, INPRISE et al are doing. M$ has at least 5 technologies that all compete with themselves.
I have spent the last two weeks reading endless websites and white papers and talking to people. I have been quoted solutions that range from free to over 10K. I have downloaded at least a gigabyte of demos and I am still no closer to solving my problem.
 
Michael Finney
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah! However, I want my book to be just java oriented. (Maybe with intro to CORBA involved too, because java has support for interacting for CORBA).
If I had more than java, it would be a huge or diluted book indeed.
 
Tim Uckun
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You may want to consider the book "Database Programming with JDBC and JAVA" by George Reese from O'Reilly. It is somewhat of a mis named book. This book talks a LOT about writing distributed apps using RMI and some about JDBC. This book gave me a lot of the whys and some of the hows of doing something like this.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is a tool out there that will automagically update classes/jars for an applet. i.e. user downloads entire applet only once, and then user only has to re-download the new classes and what not when they've been updated. Can't remember the name, but could look for it if someone needs it.
Java and Javascript can talk, but it's not the most fun thing in the world (based on what I've read and heard only -- no actual experience here).
 
Tim Uckun
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would be interested in that.
As far as Java and Javascript is concerned My question goes like this.
1) Can Java read values of the fields in forms or access the cookies?
2) Can you put an applet in your browser and call the methods of that applet from Javascript? In either case my aim is to pass the value of an HTML field on to a java app when an event occurs (onblur or onsubmit etc.)
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure if applets can access form values directly, but they most surely can be referenced by a script.
Within JS you should be able to construct Java objects as well as invoke their public methods.
Here's the JavaScript guide from Netscape detailing the process. Check out the LiveConnect chapter.
http://developer.netscape.com/docs/manuals/communicator/jsguide4/index.htm
HTH,
Brent Worden
http://www.Brent.Worden.org/
 
Frank Carver
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, this is where the lack of multi-threading begins to get hairy. I'm replying to Paul's questions about my "servlets on the client" proposal.
Why servlets and not an application? Well, mainly for ease of use and to leverage the power of existing software. The thinking goes like this. My typical application consists of User Interface, Business Rules and Storage/Transfer Infrastructure. For a fast and effective deployment I want to buy in or re-use as many parts of the system as possible.
So, consider the UI. I want a UI that is portable to as many platforms as possible, flexible, familiar and requires a minimum
of download bandwidth. That rules out most custom UI libraries. The option we chose was to use the power of the Web browser which is fitted as standard to almost every system I've encountered. It's capable of complex formatted output, input via forms and links to remote pages if required, and is effectively free. A real bargain!
So on to the transfer/storage architecture. If we're using a web-based UI, and want to minimise the processing on the client, then it makes sense to transmit as great a proportion of the data frmo the server to the client as pre-formatted HTML. So we need an architecture which is good at storing and delivering HTML-formatted data, but also capable of delivering other forms of content where required. Hmm, sounds like a web server.
So in an ideal situation both the client UI (browser) and the central transfer/storage system (web server) can be bought in. But that's only really covered the transfer and storage of data, not business logic.
Now as Paul mentions, one possibility is to download an application to the client which manages the connection with the server and updates itself if required. However, there are a few problems with this. It's going to be big, and a large part of it won't be directly business-related (code to manage updates etc.). Also, applications tend to grow into single-lump solutions where a small change may require the download of a lot of software.
As we've already decided that the UI will use a standard browser it will have to talk HTTP and listen on a socket - but that's all a web server does, so why not standardise that component, and buy one in.
So, we have a Web server on the central server, a browser and a simple web server on the client. What would be the best way to build the business login into these commercial components? Servlets, of course! Servlets are typically compact, easy to download, dynamically installable, good at generating and processing HTML User Interfaces and so on.
A system like this is capable of using a HTML UI in a standard browser, either working on-line to the central server (local servlets just pass through/cache data) or off-line (browser only accesses local servlets and data). Software updates are completely transparent to the user and so on.
I find this a very clean and powerful pattern for solving this kind of problem.
Frank.
 
paul wheaton
Trailboss
Posts: 23866
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So in a nutshell, you have a server running on the client that the client interacts with via a browser. Yes?
 
Michael Finney
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A reply in reference to Tim Uckun (posted 02-04-99 04:16 PM MT (US))
I suggest you consider buying "Not Just Java" (Java Series) by Peter Van Der Linden Paperback - 319 pages 2nd edition (January 1999)
Go to Amazon and do a book search for Not Just Java. Be sure to click on the Published 1999 version. Read the reviews and decide. Tell us if you think that is a good idea.
Thanks.
 
Frank Carver
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To Paul:
In a nutshell, yes.
Frank.
 
Michael Finney
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is using the Java plugin a bad idea for internet clients? I know the documentation says that the plug-in is intended for intranets. I bet it is because internet connections are way to slow and LANs (5mb to download JDK1.2 plugin) take 3-10 minutes anyway. Please, tell me what you think.
 
Michael Finney
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another question. If a person wants to support Macs and the latest they can run is JDK1.1.6 with a plugin, should all other development on other platforms for the product stay with JDK1.1.6?
You would have to because you want your Byte codes to run on Macs as well as Windows and such. I'm thinking about Browsers in particular here.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To Michael Finney or anyone else who can answer these questions:
In this thread, you said:
"It is possible to use a combination of Javascript and Java. Want details?"
Yes, please! I have an applet in the browser (IE only) that when an item is selected from a JComboBox, I would like to call the javascript function of window.showModalDialog(url, window);
to create a modal browser on top of the current browser. I don't want the user to return to the initial browser until they have finished with the modal browser. How do I have the applet signal javascript to call the modal dialog function when the item is selected from the JComboBox?
Also, I need to pass some data to this new page, such as file id, service name, etc. Is there anyway I can do this besides putting this data in the query string?
Thanks in advance for your help!!
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
v fox,
Please read and follow the Naming Policy. It can benefit you, read Book Promotions.
 
reply
    Bookmark Topic Watch Topic
  • New Topic