• 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

How can I dispatch Requests to >1 JSP?

 
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Does anyone have a good reference they can point me to, or just some sample code, on dispatching a Request from a servlet to more than one JSP? I have two include files in a larger page that need to receive Vectors with, respectively, up to 64 objects and up to 256 objects. I'd like to keep the processing for those two sets of data as separate as possible.
My plan was that a request would come to the servlet, it would call two discrete beans to do the processing, get the results back, and dispatch them to two different pages.
Any helpful thoughts?
Thanks!
g.
 
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Same procedure as this post:
https://coderanch.com/t/280687/JSP/java/Displaying-Dynamic-Tables
/Rene
 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could store the vector into the request object and then use the include method to pass control to a JSP page, then after the first jsp was done do the same for the second.
Let me know if I misunderstood your question.
Hope this helps.
 
Garann Means
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think I'm probably not being clear enough.
I'm trying to work out the design in such away that the two Vectors never have to coexist anywhere, excepting when they are passed through some controlling servlet. Also, when the servlet has done its job, I need to pass control back to the main JSP which includes the two smaller ones. I'd like to find a way not to pass my generated data to the big JSP, but rather, to pass each set of results to the appropriate include file.
Is that possible?
 
Steve Chernyak
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think I understand:
You only want the vectors available in the scope of the includes. Is that right?
If yes, then I dont know of anyway to declare them outside of that include itself.
You could use some thing like a JavaBean or a taglib inside the include and declare the vector with the page scope.
 
Garann Means
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Steve,
You're saying just call the bean directly from the included page, don't try and pass it through the servlet? That seems good to me.
But how, then, do I get the included pages to refresh their data? I.e., I have a form in the parent page that takes the input used to generate the data for the includes. If my guess is correct, I should use the servlet the form submits to to pass the request to each of the include pages, then leave them to do their work separately using their own beans. Is that correct?
Thank you for your help!
g.
 
Steve Chernyak
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When the main jsp includes the other two all three of them have access to the request. You can use the scripting variable "request", so you don't need to explisitly pass it from include to include (this is already done for you when using jsps).
If the processing that the included JSPs will be doing is for presentation logic that is dependant on previous input from the user then I dont think you need the servlet to do any of the includes logic.
In my opinion the servlet could recieve the request, and if there is no processing other then what to present next, i would just have servlet forward to the main jsp, and include the other two from there.
 
Right! We're on it! Let's get to work tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic