Solved

How to pass variable for PARAM's value.

Posted on 1998-06-24
6
212 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
eclipse buid path vs tomcat lib path 10 45
ejb entity bean example 2 51
Tagging and Merging on Branch 1 65
Delete .class files at every compile 4 53
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
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…

731 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