I have a functioning struts web application. I want to display some graphics based on data from my web application and my current thinking is to have an applet on a page which gets it's data from a servlet (or an struts action) and renders the appropriate images.
I have written the applet and have all my data in one object but connecting from the applet to a struts action just seems wrong and I can't seem to add another servlet into web.xml without the rest of the application breaking either (are you even really meant to use other servlets when you are using struts?).
Am I going about this all wrong? Is there an easier way? Any help would be appreciated.
On your way in you may have missed that we have a policy on screen names here at JavaRanch. Basically, it must consist of a first name, a space, and a last name, and not be obviously fictitious. Since yours does not conform with it, please take a moment to change it, which you can do right here.
As to your question, using a Struts action would seem weird - not nearly as natural as using a servlet directly. That is definitely possible, though, in addition to using the Struts servlet. What problems are you facing in particular setting that up?
Joined: May 07, 2008
I wrote a httpservlet (would genericservlet be better) and added in the definitions into web.xml but then I could not load jsp pages from my struts application and so I wondered if adding additional servlets interrupted the normal flow of the actionservlet and requests to it and should be avoided.
Also I didn't know if my servlet was actually running or not.
It made me sad... :-(
Joined: Mar 22, 2005
Extending HttpServlet is the way to go. How are you mapping the servlet in the web.xml file? It sounds as if there may be an overlap between the servlet mapping and the Struts mapping.