External <PARAM> Code.

MrPrince
MrPrince used Ask the Experts™
on
I have a quick question regarding JAVA and HTML. I'm building an Intranet for my work place. Currently each one of my Intranet pages uses tables, and a Java class for the navigation menu. In my html code I'm using the <PARAM> tag to tell JAVA exactly what I want it to do. This works well and I'm happy with the result. However if I need to make a change to my menu I would have to update each page individually. Although I could use Find and Replace to go through the site making site wide changes to the menu I would prefer to have one piece of code with my <PARAM> information that each page would pick up and use. This would make life much easier for site wide updates and remove a large block of code from each page. Any ideas as to how I would achieve this?

Thanks.

MrPrince.      
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016

Commented:
So you're using applets then, jsp or what?

Author

Commented:
Sorry, I'm being vague. I'm using a applet, its the code from the applet I'm trying to move away. Hope this makes sense.
Top Expert 2016

Commented:
You could have a simple properties file on the server from which you serve your applets. The applets could then connect and read this file. So the result is that only one file need change.
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Commented:
another option is to use some scripting language for your pages (PHP / ASP / JSP)

Author

Commented:
CEHJ - Could you be more specific?

Commented:
CEHJ's suggestion is to

1. put all your configuration in a single .txt file on server;
2. on startup applet downloads this .txt file, parses it and diplays the information.
Top Expert 2016
Commented:
Thanks heyhey :-)

1. Create properties file or some such, e.g.

param1=X
param2=Y
param3=Z

2. Have the applet make a connection to this file and read it in its init() method.

When you recompile your applet, you can get it to do this and ignore the params on the html page. This means:

a) You do not have to change anything on your existing html pages.
b) When you want to change the applets' initialization, you only need to do it in one place (the properties file)

I've just thought, as i was about to click submit on this, that you can even override applet's getParameter() method to read its Properties object so even less needs to change in the applet. Of course if you want to be really thorough, you should override getParameterInfo() too :-)
Top Expert 2016

Commented:
If this sounds a bit abstract by the way, i could give you a hand if and when you come to do it.

Author

Commented:
CEHJ,

Thanks for the tips that sounds exactly like what I want to do, your help is/would be appreciated! By the way, my N.A. has asked me to set this up on a NT4 machine running PWS not IIS. Is this going to present big problems? Also below is a sample of the code I’m trying to move away, it may give you a better idea as to what I’m trying to achieve:

 <applet code="apPopupMenu.class" codebase="..//WebScripts/Java/" width="730" height="23" align="absmiddle" archive="apPopupMenu.jar">
                    <param name="isHorizontal" value="True">
                    <param name="overSound" value="pix/put.au">
                    <param name="clickSound" value="pix/empty.au">
                    <param name="systemSubFont" value="True">
                    <param name="solidArrows" value="True">
                    <param name="buttonType" value="1">
                    <param name="status" value="link">
                    <param name="alignText" value="left">
                    <param name="backColor" value="FDDCAF">
                    <param name="backHighColor" value="FDC16B">
                    <param name="fontColor" value="000000">
                    <param name="fontHighColor" value="000000">
                    <param name="font" value="Arial,12,1">
                    <param name="3DBorder" value="false">
                    <param name="pressedItem" value="0">
                    <param name="menuItems" value="
       {_,_,_}
      { Organisation}
      {|Staff Database,/Organisation/StaffDatabase.asp,_self}
       {|Org Charts,/Organisation/OrgCharts.asp,_self}
       {|Board,/Organisation/BoardMembers.asp,_self}
       {|Opportunities,/Organisation/Opportunities.asp,_self}
       //
      { Information}
      {|Hours and Pricing,/Information/HoursPricing.asp,_self}
       {|Parking & Tour Information,/Information/ParkingTourInfo.asp,_self}
       {|Facts,/Information/Facts.asp,_self}
       {|Event Pro/Events,/Information/EventPro.asp,_self}
       {|Daily News,/Information/DailyNews.asp,_self}
       {|Statistics}
 </applet>
Top Expert 2016

Commented:
>>Is this going to present big problems?

No reason why. All you need to do is create a properties file:

isHorizontal=True
overSound=pix/put.au

etc.


and get the applet to read it.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial