Solved

How to pass variable for PARAM's value.

Posted on 1998-06-24
6
207 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

758 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

12 Experts available now in Live!

Get 1:1 Help Now