• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Reference to Package Properties from Javascript

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am new to java. Would really appreciate if someome could help.

I am trying to access the pacakage properties from javascript. It is giving an error stating Object required.

Can someone tell me where I am going wrong.

Thanks in advance.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean by 'package properties', and how can we help you if you don't show any code?
 
JackKumar Kumari
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry about that.
Below is the code
question.one and question.two are defined in package properties.




Thanks in advance.
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You still haven't answered what you mean with "package properties". This makes no sense in the JavaScript world, let alone Java world.
 
JackKumar Kumari
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Youy might want to google on it and do some reading on this

Description
The Packages property is a "global" variable in JavaScript. It is a read-only reference to a JavaPackage object, and is defined as a property of all Window objects. Because the Packages property is the same for all Window objects, you can always refer to it simply as Packages, rather than explicitly accessing it through a particular Window object.


Thanks
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is quite a huge difference between "properties" and "property" when talking in Java or JS terms. Please pay attention to your English.

Well OK, why are you trying to access them as document elements instead of as objects then? Why do you think that they are document elements with a style? What's the functional requirement after all? What is it what you're trying to achieve? The posted code makes no sense.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

JackKumar Kumari wrote:Youy might want to google on it and do some reading on this


So let me get this straight. You use all the wrong terms for something, don't even spell it correctly ("pacakage properties"), and then tell volunteers that are trying to help you to go goggle something?

I think you need to rethink your strategy with respect to requesting help.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do not think Packages.JavaPackage does what you think it does. Are you using an applet or you expecting it to read code off the server?

Eric
 
JackKumar Kumari
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the volunteers need to be a little polite to people who are new to Java and dont really understand the terms.

 
JackKumar Kumari
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Eric,

I'll tell you what I know. I am new to all this and really don't understand too much of it.

I have all the content that need to be used in Package.properties in Action.
example
question.one = What is your name?

I am using struts 2 and when I access question.one it gives What is your name? but when I use in javascript its gives me an error.

Hope I was able to explain. Please be easy on me.

Thanks
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

JackKumar Kumari wrote:I think the volunteers need to be a little polite to people who are new to Java and dont really understand the terms.


The volunteers have been perfectly polite. There's no lack of politeness in asking for clarification when you have not been clear. Also, making recommendations on how to better approach seeking help is also polite.

Now, on with the show. Where are you defining the properties that you'd like to read? I think Eric is correct in that you are expecting JavaScript to be able to do something that it cannot.
 
Ranch Hand
Posts: 249
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If it is the javascript specification 1.1's "Packages" object that you are refering to, in that case you are using it in a wrong way.
"Packages" is javascripts way of invoking java classes.... I hope you understand that java and javascript have absolutely no relation with each other
and are used for totally different scenarios too. may be the below example would help you understand this :

function createWindow() {
var theOwner = new Packages.java.awt.Frame();
var theWindow = new Packages.java.awt.Dialog(theOwner);
theWindow.setSize(350,200);
theWindow.setTitle("Hello, World");
theWindow.setVisible(true);
}

..... will help you create a java awt window, though it is being invoked from javascript.

And, I dont understand how you could use it for the scenario you mentioned. Can you describe a bit more of the history of this problem that you are trying to solve?
 
JackKumar Kumari
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What I am trying to do is to access the properties file from javascript.

Do I make more sense now?
I am not really sure with the terminology, I think I got it right now.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic