Forums Register Login

app-to-app call

+Pie Number of slices to send: Send
Hello JSP experts, any advice on this JSP problem?
I have two JSP/servlet applications called “SimpleQuantity” and “DoWork”. DoWork wants to use a “quantity” generated and displayed by the SimpleQuantity app. I’m writing DoWork now and don’t want to modify or duplicate the code in the stand-alone SimpleQuantity app. DoWork will invoke the SimpleQuantity app via redirect (either to a new browser instance or to a frame target in the same browser; doesn’t matter?). SimpleQuantity fortunately stores its resulting “quantity” in “its” session object, as well as displaying it in its HTML output. I hope that DoWork can then get this “quantity” from the session object (when SimpleQuantity completes). I believe there is only one session object here because DoWork did a redirect to SimpleQuantity rather than forward.
My question(s):
1. Is this “the right” approach in the JSP world? Is there another “proper” way to seamlessly integrate such JSP applications without having to modify the existing app?
2. If “session” object might work, is there a way for DoWork to access the Application scope object or page scope of SimpleQuantity (to be cleaner and maintain good encapsulation)? There should be a clean ways for a JSP to “expose” just the vars intended to be used from other apps.
3. Is there a way for SimpleQuantity to "signal" DoWork when its done? (e.g. send an interrupt to wake up a thread for example?)
Thanks in advance for any advice. :roll:
john
+Pie Number of slices to send: Send
Sounds like a job for the MVC pattern (model view controller). From your description of SimpleQuantity, you have the main business logic in your servlet. You should abstract it out so that all the logic is done in pure java, and have the servlet merely pass information along. That way you can re-use that code in any servlet as opposed to being tied down to one specific servlet.
+Pie Number of slices to send: Send
I guess using Struts would be more useful in case U decide on with MVC approach..
+Pie Number of slices to send: Send
Thanks but the use of MVC or Struts is not applicable here. First, I don't have access to the software on the host where SimpleQuantity runs, as I indicated in my problem statement. Consider it a 3rd party application and all I know is that it stores a certain quantity in its session object. Presently, I am not tasked to re-architect this system. So the question is simple. To re-state the essence of the question:
Would a good JSP programmer write the DoWork application to access the "quantity" from the "shared" session object, as I have described? Or is there is smarter way, using JSP and Servlets only? (That does not involve re-architecting the two systems to run on a single host and rewrite it to use J2EE). Thanks again.
Shiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 871 times.
Similar Threads
IBM Exam 157 - Questions and Answers (Sample Exam)
can't run struts-example.war in WAS 4.0.3
157 Question Help and Resourses
Class Cast Problem using PortableRemoteObject.narrow
Not able to retrieve files name s from a folder
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 02:27:13.