• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Servlet limitations?

 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I am interested in using servlets to develop an on-line application because I already know Java. The problem is the book I have doesn't really tell me the limitations of servlets. Is the whole core java API available?
For example, one concern is that a servlet will not be capable of creating and saving out image files using the java.awt.image.BufferedImage and com.sun.image.codec.jpeg packages. Can anyone tell me if there are any features like this that may not be useable in servlets please?
thanks,
Ben.
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The J2EE environment is layered on top of the core Java libraries. The only limitations are those having to do with where you are running. For example, you can manipulate images, but you can't use Swing, since Swing runs on the console, and the console's likely to be locked in a dark room somewhere.
One limitation in the graphics environment however, is that Java is extending the system's native graphics environment - so there'd better be one. Unix users find out about this when they try and use the graphics services and there's no windowing system (such as X windows) running on the machine.
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
servlet appliaction are not scalabe.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hanumanth - I am sure we would all like to know your reasoning for that statement.
Bill
 
Ben Wood
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see.
So, I currently have a stand-alone Java app which creates a graph which can be saved as a jpeg. This graph is drawn by over-riding a JPanel's paintComponent() method. Therefore I can't do the same thing in a servlet I assume if swing isn't available? Can I use AWT components? What about the canvas class? Do you have any ideas what the best way to draw my graph might be in order to save it out later as an image?
thanks for the help,
Ben.
 
Tim Holloway
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your main limitation on use of graphics routines is you can use them on memory objects but not on objects that rely on actual physical hardware. For example, you can create/manipulate graphics bitmaps, but at best, trying to use a ListBox control would cause it to pop up in that locked room I mentioned.
On the old Commodore Amiga OS, the graphics services, the services relating to manipulating overlapping graphics areas and the services relating to actual user-interface controls (Windows & widgets) were discrete packages. AWT crams all these into one, so the distinctions may not be so obvious. I can't actually think of any use for Swing outside an interactive UI, however.
Using JPanels and paint() methods isn't likely to work well. When synthesising bitmaps or vector graphics, an AWT canvas and direct rendering is moe appropriate. Paint() is intended for refreshing images, and a graphic not being obscured by overlapping windows and the like doesn't need that.
You may find it more productive to simply go out and buy a commercial Java graphing package.
 
Ranch Hand
Posts: 193
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ben
It really depends on how you want your users to interact with your app. You say that the existing app produces a graph that can be saved as a jpeg.
If you amend it so that the jpeg is automatically created on the server, then you can embed that in the HTML returned to the user.
A possible solution, but don't know if it will work for your situation.
 
Ben Wood
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tim, Graeme...
Thanks for your ideas. What Graeme suggests about creating the jpeg on the server and then linking to it from an html file is exactly what I want to achieve, but according to Tim this will be difficult because my existing graphing application is swing based. This is (sort of) how it works...

At the minute drawing on g2d is done within paintCoponent() of a JPanel.
I just need to know whether I can hope to use this general approach using a servlet, assuming I work round the use of paintComponent() - e.g. by drawing the graphics in memory, rather than on screen in a window. Buying graphing software to do this for me is a non-starter; it doesn't exist for the types of graphs and plots I'm thinking of which are highly specialised and some are of my own design. The budget is also small;-)
thanks,
Ben.
 
Graeme Brown
Ranch Hand
Posts: 193
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yup that approach will definitely work. I have previously written an app using that technique, with in-memory painting.
 
hanumanth reddy
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Limitation of servlets
memory leakage while compiling servelt.
no support for awt or graphics.
and Servet developer need to know the basic html css and javascript etc..(along with the java)
 
Graeme Brown
Ranch Hand
Posts: 193
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by hanumanth reddy:
Limitation of servlets
memory leakage while compiling servelt.
no support for awt or graphics.
and Servet developer need to know the basic html css and javascript etc..(along with the java)


memory leakage while compiling servlet - get a decent compiler!
no support for awt or graphics - duh, that's the point of servlets! Thin clients.
Servlet developer need to know... - Thats where JSP comes in. Don't pollute java code with HTML, put it in a JSP. If you work in a team environment then the JSP can be written be a web developer, leaving programmers to work on the business logic.
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


memory leakage while compiling servelt.
no support for awt or graphics.
and Servet developer need to know the basic html css and javascript etc..(along with the java)


memory leakage - sorry you have a problem, nothing to do with scaling
support for graphics - open your eyes, every servlet book - mine included - shows how to generate graphics dynamically in servlets
Servlet developer needs to know HTML, CSS - well DUH! anybody doing anything on the web with any technology needs to know something about the standards. If your team is divided into web designers and programmers, thats what JSP is for. Anyway, nothing to do with scalability.
You forgot to whine about having to know XML as well. Another DUH! Anybody trying to work in this field better be up to speed on XML.
Bill
 
This tiny ad is guaranteed to be gluten free.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic