aspose file tools*
The moose likes Beginning Java and the fly likes basic question & LiveConnect question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "basic question & LiveConnect question" Watch "basic question & LiveConnect question" New topic
Author

basic question & LiveConnect question

Brett Zamir
Greenhorn

Joined: Jul 19, 2007
Posts: 6
Hello,

I have two questions:

1) Being new to Java, I haven't been able to get a clear picture on whether Java, by being able to be run on the server and as standalone client apps, could easily be migrated from being a server app into being a client app or vice versa (obviously assuming the nature of the app could lend itself to that). For example, can one use JSP code to build a client-side interface (that doesn't necessarily query a remote server but which can be easily deployed and downloaded by Joe or Jane user) and then write a servlet which is similar to the client-side Java code and can also harness the JSP? I want to use the most portable option (specifically to make a text browsing app). I like using JSP, if that is possible, as by using HTML, it is also closer to being portable if I ever switch from Java.

2) While this is perhaps more of a Mozilla question, I haven't been able to get an answer, and this definitely does impinge on Java, so, here goes...

Mozilla apps can use LiveConnect technology to allow Javascript calls to be translated into Java.

However, while I'm able to get the built-in Java classes working, I couldn't get the following to work.

When I try to use a Berkeley DB XML class (which is in my classpath and
which I can access from NetBeans without problem) in a XUL document, I get a
TypeError in Firefox that XmlManager() is not a constructor:

var xmlman = new Packages.com.sleepycat.dbxml.XmlManager();

Any idea how to make sure these Packages become accessible to Mozilla? As far as I can tell, this should work according to http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:LiveConnect_Overview:JavaScript_to_Java_Communication

I also couldn't figure out how to try to load the classes dynamically
using the code at the bottom of
http://developer.mozilla.org/en/docs/Java_in_Firefox_Extensions and I definitely want to make sure I can at least get things working with LiveConnect before possibly trying the Java Firefox Extension approach.

thanks,
Brett
Svend Rost
Ranch Hand

Joined: Oct 23, 2002
Posts: 904
Hi Brett,

welcome to the Ranch.

Im not quite sure I understand your first question. I've taken the liberty
to translate it into:
1.1: Can a Java application/system/program easily be transformed from a Standalone Application to a Web Application?
It can be transformed - wheater or not the transformation will be easy depends on the structure/design of the original system. Let the objects (Model layer) perform the work (calculations, DB access ect) instead of having the logic in the same files as the user interface (Presentation Layer).

Does this answer your query? I'll check back later.

/Svend Rost
Brett Zamir
Greenhorn

Joined: Jul 19, 2007
Posts: 6
Thanks, Svend...

Yes, that basically was my question...

But I wonder which type of Presentation Layer I should be using... Is JSP+HTML usable as the Presentation Layer in a standalone application? I'd like to be able to easily migrate not only the Java code, but also the Presentation layer.

thanks,
Brett
Les Hayden
Greenhorn

Joined: Jun 19, 2002
Posts: 28
Unfortunately, JSP requires some form of Java container (server). Each user would have to have access to the container in order for it to work. In a case where the computer was notconnected to the internet, the local computer would have to have a container like Tomcat installed to interpret the JSP tags before the user could see the results.


Les Hayden
Brett Zamir
Greenhorn

Joined: Jul 19, 2007
Posts: 6
Thanks, Les...

How cumbersome would it be to package some kind of "light" server with a distribution?
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8815
    
    5
Hi Guys,

No worries, but I'm going to slide this over to the intermediate forum.


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: basic question & LiveConnect question