Using Swing with JSP


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: Using Swing with JSP

  1. #1
    Shaun Botha Guest

    Using Swing with JSP


    I create a swing application - it works and compiles
    I then create a .jsp file and copy the code between the tags. I use Tomcat
    (the latest) as a JSP Server and the **** thing refuses to compile. Some
    of the errors Tomcat returns are:

    Should I use the swing class in a Bean rather - PLEASE HELP!!!!!

    Unable to compile class for JSPC:\tomcat\work\localhost_8080%2Fexamples\_0002fjsp_0002fshaun_0002fswing_0002ejspswing_ jsp_0.java:58:
    Missing term.
    out.write("\r\n\r\n\r\n\r\n\r\n\r\n Swing Demo in JSP \r\n");
    ^
    C:\tomcat\work\localhost_8080%2Fexamples\_0002fjsp_0002fshaun_0002fswing_0002ejspswing_jsp _0.java:58:
    ';' expected.
    out.write("\r\n\r\n\r\n\r\n\r\n\r\n Swing Demo in JSP \r\n");


  2. #2
    Paul Clapham Guest

    Re: Using Swing with JSP

    You want to run a Swing application in a JSP???? What could that possibly
    mean? Yes, if you could compile it, then the JSP would run on the server,
    and probably display the GUI there, but why would you want that? In the
    meantime, the person at the client who submitted the request would be
    sitting there waiting for somebody at the server end to close the Swing
    window so the JSP could get on with its work.

    Perhaps you should rethink what you are doing. Even if you fix your code
    and put the semicolons in the right place, it probably isn't going to be of
    any use.

    PC2

    "Shaun Botha" <shaunbotha@mweb.co.za> wrote in message
    news:3b2a1b83$1@news.devx.com...
    >
    > I create a swing application - it works and compiles
    > I then create a .jsp file and copy the code between the tags. I use

    Tomcat
    > (the latest) as a JSP Server and the **** thing refuses to compile. Some
    > of the errors Tomcat returns are:
    >
    > Should I use the swing class in a Bean rather - PLEASE HELP!!!!!
    >
    > Unable to compile class for

    JSPC:\tomcat\work\localhost_8080%2Fexamples\_0002fjsp_0002fshaun_0002fswing_
    0002ejspswing_jsp_0.java:58:
    > Missing term.
    > out.write("\r\n\r\n\r\n\r\n\r\n\r\n Swing Demo in JSP

    \r\n");
    > ^
    >

    C:\tomcat\work\localhost_8080%2Fexamples\_0002fjsp_0002fshaun_0002fswing_000
    2ejspswing_jsp_0.java:58:
    > ';' expected.
    > out.write("\r\n\r\n\r\n\r\n\r\n\r\n Swing Demo in JSP

    \r\n");
    >




  3. #3
    Shaun Botha Guest

    Re: Using Swing with JSP


    "Paul Clapham" <pclapham@core-mark.com> wrote:
    >You want to run a Swing application in a JSP???? What could that possibly
    >mean? Yes, if you could compile it, then the JSP would run on the server,
    >and probably display the GUI there, but why would you want that? In the
    >meantime, the person at the client who submitted the request would be
    >sitting there waiting for somebody at the server end to close the Swing
    >window so the JSP could get on with its work.
    >
    >Perhaps you should rethink what you are doing. Even if you fix your code
    >and put the semicolons in the right place, it probably isn't going to be

    of
    >any use.
    >
    >PC2

    Paul

    I have a very rich GUI. I propably could run it as an applet (the problem
    is in my company I have 11,000 clients. If I run as an applet I have to
    install the J2RE on all these machines and also provide the JAVA plugin for
    IE before they can use my app. Ig I can do it in a JSP I dont have to give
    them anything. Or am I wrong

    What advice can you give shoudl I use applets or applications. Doing the
    java stuff is not the problem but to choose the right model to implement
    seems to be problematic.
    Shaun


  4. #4
    Paul Clapham Guest

    Re: Using Swing with JSP

    You are right and wrong. About the applets, yes Swing applets are a huge
    nuisance and with 11,000 clients you would be just asking for trouble trying
    to use them. I would reject that idea right away. But a JSP is just a
    mechanism for generating HTML to be sent to a browser client. That's all it
    is, HTML with Java code embedded in it to enable you to vary the HTML you
    produce based on whatever business rules you implement.

    So I don't have a magic-wand answer for you. If you want the rich GUI you
    get with Swing then you have two options: (1) write a Swing applet and
    hassle it out (2) write a Swing application and get it installed on each of
    your clients. Your other options are: (3) try to simulate your GUI using
    only AWT plus perhaps add-on classes that you can buy that do trees, tables,
    and so on (4) use HTML for your GUI and write JSPs and servlets.

    Installing a Swing application on your client's system is less daunting than
    it might appear; check out the software at http://www.zerog.com/ that allows
    you to build installation packages for Java on a variety of target
    platforms. However, whether you could persuade each of your 11,000 clients
    to download and install your application, I don't know. I can tell you
    about the technical pros and cons but you'll have to decide what's practical
    in your context.

    PC2

    > Paul
    >
    > I have a very rich GUI. I propably could run it as an applet (the problem
    > is in my company I have 11,000 clients. If I run as an applet I have to
    > install the J2RE on all these machines and also provide the JAVA plugin

    for
    > IE before they can use my app. Ig I can do it in a JSP I dont have to

    give
    > them anything. Or am I wrong
    >
    > What advice can you give shoudl I use applets or applications. Doing the
    > java stuff is not the problem but to choose the right model to implement
    > seems to be problematic.
    > Shaun





  5. #5
    mark Guest

    Re: Using Swing with JSP


    You might also want to look at Java web start (www.java.sun.com). I don't
    think any solution will be perfect. But if you have rich client coding/maintaining
    JSP's will not be fun. And swing applets are not that bad. Also, you may
    want to make sure all your data access occurs server side (obviously will
    for JSPs). That will also cut down on client issues.

    Mark

    "Paul Clapham" <pclapham@core-mark.com> wrote:
    >You are right and wrong. About the applets, yes Swing applets are a huge
    >nuisance and with 11,000 clients you would be just asking for trouble trying
    >to use them. I would reject that idea right away. But a JSP is just a
    >mechanism for generating HTML to be sent to a browser client. That's all

    it
    >is, HTML with Java code embedded in it to enable you to vary the HTML you
    >produce based on whatever business rules you implement.
    >
    >So I don't have a magic-wand answer for you. If you want the rich GUI you
    >get with Swing then you have two options: (1) write a Swing applet and
    >hassle it out (2) write a Swing application and get it installed on each

    of
    >your clients. Your other options are: (3) try to simulate your GUI using
    >only AWT plus perhaps add-on classes that you can buy that do trees, tables,
    >and so on (4) use HTML for your GUI and write JSPs and servlets.
    >
    >Installing a Swing application on your client's system is less daunting

    than
    >it might appear; check out the software at http://www.zerog.com/ that allows
    >you to build installation packages for Java on a variety of target
    >platforms. However, whether you could persuade each of your 11,000 clients
    >to download and install your application, I don't know. I can tell you
    >about the technical pros and cons but you'll have to decide what's practical
    >in your context.
    >
    >PC2
    >
    >> Paul
    >>
    >> I have a very rich GUI. I propably could run it as an applet (the problem
    >> is in my company I have 11,000 clients. If I run as an applet I have

    to
    >> install the J2RE on all these machines and also provide the JAVA plugin

    >for
    >> IE before they can use my app. Ig I can do it in a JSP I dont have to

    >give
    >> them anything. Or am I wrong
    >>
    >> What advice can you give shoudl I use applets or applications. Doing

    the
    >> java stuff is not the problem but to choose the right model to implement
    >> seems to be problematic.
    >> Shaun

    >
    >
    >



  6. #6
    Paul Wilson Guest

    Re: Using Swing with JSP


    You want to use Swing with jsp's? Can't be done directly. You can use JavaWebStart
    to download applications to clients.

    Better yet (for you), have a look at WebCream (http://creamtec.com:30422/webcream/index.html).
    It's a tool that translates Swing to html. Great tool!

    It'll do it.




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center