Solved

How to pass variable for PARAM's value.

Posted on 1998-06-24
6
208 Views
Last Modified: 2010-03-30
I want to pass parameter value to JAVA applet.
The value is not a Constant-value String, rather, it is
a Variable-value String.
eg
<applet code="RainbowText9.class" width=340  height=22>
<param name=text value=varnam>
                 (instead of value="Welcome to ...."
Note : varnam is a SCRIPT variable that have been assigned
       with value.
</applet>

My question is :-
   a) It is allow to pass a SCRIPT's variable (varnam)
      to the Applet's PARAM VALUE=varnam
   b) If (a) above is not allow, then how can this be done?  
Rgds,

0
Comment
Question by:heng03
  • 3
  • 2
6 Comments
 
LVL 5

Expert Comment

by:msmolyak
ID: 1223639
No, Java expects a constant string as a parameter. The simplest solution is to use JavaScript to modify the applet tag before the applet is started. I'll try to come up with an example.
0
 
LVL 4

Accepted Solution

by:
evijay earned 20 total points
ID: 1223640
the syntax is &{javascriptvariablename}

So, your tag becomes


<applet code="RainbowText9.class" width=340  height=22>
       <param name=text value=&{javascriptvarnam}>
 
       </applet>
0
 
LVL 4

Expert Comment

by:evijay
ID: 1223641
Sorry for the typo

the answer is like this


       the syntax is &{javascriptvariablename};

       So, your tag becomes


       <applet code="RainbowText9.class" width=340  height=22>
              <param name=text value=&{javascriptvarnam};>

 
         
              </applet>
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:heng03
ID: 1223642
Hi evijay,
Thanks for your help.
I have a few question related to the above example applet.
I want to pass variable to the applet's width= parameter
 
   eg
   <applet code="RainbowText9.class" width=varsize  height=22>
                         (instead of width=320)
   Note : varsize is a SCRIPT variable that have been assigned
          with numeric value. eg varsize=250;
   </applet>

   P.S. : I tried width=&{varsize}, but do not work
          I tried width=varsize & width=&varsize, also
          do not work.
Pls advice, thank you.

0
 

Author Comment

by:heng03
ID: 1223643
Hi Evijay,
I have one more question :-
a) This RainbowText9 class is extends Applet and Implement Runnable. Beside running in browser as applet, how can I run
it in DOS/window as a application.

Note :
I tried C:\JAVA\BIN\JAVA RainbowText9
But got message "In class RainbowText9: void main(String argv[])
is undefined.

Pls help. Thanks.


0
 

Author Comment

by:heng03
ID: 1223644
Hi Evijay,

I tried width=&{varsize};   (this work OK)
Thanks

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
for i loop in grovy 1 44
Java Filesystem manipulation of Word Docx file (find replace text) 3 66
egit plugin on eclipse 8 37
xampp tool 12 25
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now