Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

basic question & LiveConnect question

 
Brett Zamir
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 904
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Brett Zamir
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Les...

How cumbersome would it be to package some kind of "light" server with a distribution?
 
Bert Bates
author
Sheriff
Posts: 8898
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

No worries, but I'm going to slide this over to the intermediate forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic