Adding basic web front-end to Java app

Discussion in 'Java' started by gigajosh, Aug 25, 2003.

  1. gigajosh

    gigajosh Guest

    Can anyone tell me how to add a really basic web front-end to my
    bog-standard Java app. I just want to run the plain old main() method by
    passing the arguments in via a web page.
    Do I have to create a form plus a simple applet/servlet or something,
    then just call my program from the applet/servlet?
    Any tips on templates I could use for the form and the applet/servlet?

    Many thanks,
     
    gigajosh, Aug 25, 2003
    #1
    1. Advertising

  2. "gigajosh" <> wrote in message
    news:...
    > Can anyone tell me how to add a really basic web front-end to my
    > bog-standard Java app. I just want to run the plain old main() method

    by
    > passing the arguments in via a web page.
    > Do I have to create a form plus a simple applet/servlet or something,
    > then just call my program from the applet/servlet?
    > Any tips on templates I could use for the form and the applet/servlet?


    Really basic? Create a form with text fields for each of the parameters
    you want to pass to the app in question. Submit that form to a servlet.
    Then, you have two options:
    - make the servlet call com.foobar.YourApp.main(String[] args) directly
    - use Runtime.exec() to execute "java com.foobar.YourApp args"

    The first runs the app in-process, which is nice 'n' fast but won't work
    if your app calls System.exit() - that would shut down the whole servlet
    container. The second is less efficient since it needs to fire up a new
    process and JVM each time, but it does isolate your servlet container
    from the application. It also makes it easier to capture the app's
    output (Process.getOutputStream()). I'd go for option two.

    Then, just capture the output and send that back as an HTML page and
    voilĂ , a web frontend :)

    HTH,
    Michiel
     
    Michiel Konstapel, Aug 25, 2003
    #2
    1. Advertising

  3. gigajosh

    Josh Downes Guest

    Thank you both for your help. It's plenty to get me started :))



    gigajosh wrote:

    > Can anyone tell me how to add a really basic web front-end to my
    > bog-standard Java app. I just want to run the plain old main() method by
    > passing the arguments in via a web page.
    > Do I have to create a form plus a simple applet/servlet or something,
    > then just call my program from the applet/servlet?
    > Any tips on templates I could use for the form and the applet/servlet?
    >
    > Many thanks,


    --
    De informatie in deze e-mail (inclusief bijlagen) is vertrouwelijk en
    uitsluitend bestemd voor de geadresseerde.
    Indien u dit bericht onterecht ontvangt, wordt u verzocht de inhoud niet te
    gebruiken en de afzender direct te
    informeren door het bericht te retourneren en van uw computer te
    verwijderen. NV Casema is niet
    verantwoordelijk en wijst iedere aansprakelijkheid af voor en / of in
    verband met alle gevolgen en / of schade van
    de verzending, ontvangst en /of inhoud van deze e-mail. Casema is niet
    aansprakelijk voor computervirussen die
    veroorzaakt zijn door deze e-mail.

    The information in this e-mail is confidential and intended solely for the
    person to whom it is addressed. Should
    you receive this message unintentionally, please do not use the contents
    herein and notify the sender immediately
    by return e-mail and then delete the message from your computer. NV Casema
    cannot be held responsible or
    liable in any way whatsoever for and/or in connection with any consequences
    and/or damage resulting from the
    dispatch and receipt of this e-mail and the content of this e-mail. Casema
    takes no responsibility for any computer
    virus that might be transferred by way of this email.
     
    Josh Downes, Aug 26, 2003
    #3
  4. gigajosh

    gigajosh Guest

    Thanks very much for the info, this is plenty to get me started :))


    gigajosh wrote:

    > Can anyone tell me how to add a really basic web front-end to my
    > bog-standard Java app. I just want to run the plain old main() method by
    > passing the arguments in via a web page.
    > Do I have to create a form plus a simple applet/servlet or something,
    > then just call my program from the applet/servlet?
    > Any tips on templates I could use for the form and the applet/servlet?
    >
    > Many thanks,
     
    gigajosh, Aug 26, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Reddy Tech Recruiting
    Replies:
    3
    Views:
    409
    John G Harris
    Sep 1, 2005
  2. Karen Sundquist
    Replies:
    1
    Views:
    151
    Saurabh Nandu
    Dec 1, 2003
  3. Matt

    IIS ASP is front end or back end?

    Matt, Apr 4, 2004, in forum: ASP General
    Replies:
    3
    Views:
    261
    Ken VdB
    Apr 5, 2004
  4. The alMIGHTY N

    back-end vs. front-end calculation

    The alMIGHTY N, Apr 2, 2007, in forum: Javascript
    Replies:
    5
    Views:
    423
    The alMIGHTY N
    Apr 3, 2007
  5. vunet
    Replies:
    2
    Views:
    190
    vunet
    May 19, 2009
Loading...

Share This Page