Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How do display/generate webpage content with info from an array in a .java file?

  1. Mar 17, 2007 #1
    Does anyone know how I would go about displaying/generating webpage content with info from an array in a .java file?

    Suppose you click on cars.com, once you do, the webpage will display the contents (say car names) of an array from a .java file. How do I do this?

  2. jcsd
  3. Mar 17, 2007 #2


    User Avatar
    Science Advisor

    Since the .java file isn't compiled you have a couple of options. If you must read the "car names" from an array in a java file (instead of from an XML file or database, or any data file) then you can use ASP or PHP to read the contents of the .java file, locate the array, parse the contents and write them to a web page.

    Alternatively you could compile the .java file into a .class file, then write a JSP application (running under an Apache Tomcat server for example) that imports the appropriate namespace and reads the array entries directly.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook