• 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 to check value initialisation between two servlets

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
i want to know that if i have one servlet and i am taking input and storing it as operand1(say). and another servlet in which i am doing the same process for operand2.
i want that both servlet should check of others value initialized or not and if so do the multiplication of the same.
please basically tell me how servlet1 will check for servlet2.as for servlet2 we can check through requestdispatcher but how servlet1 will check for servlet2
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like a poor design to me. What's the actual use case? There's likely a better way to model this.
 
rohit raja
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Sounds like a poor design to me. What's the actual use case? There's likely a better way to model this.



The actual use case is like two servlet should check each one of them for whether the value taken input in that servlet is initialized or not?

 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, that's how you are trying to accomplish it. The question is higher-level: why? What are these values? Why do they need to be shared?
 
rohit raja
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:No, that's how you are trying to accomplish it. The question is higher-level: why? What are these values? Why do they need to be shared?



Actually my teacher have given me this as my assignment which i need to submit by 28 of this month. i am sending you the actual question which he have given to me please help me.

here is the question


Display the sharing of context among different servlets of same web application. First servlet should accept one input and store it as operand1 in session attribute. The second servlet should accept another input and store as operand2. Each of these servlet should check if other attribute is set, and if so, compute the multiplication of two numbers and display the result.
 
Saloon Keeper
Posts: 7585
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The question already says how to do it: with session attributes. Read up on those in your textbook -or whatever learning materials you have-, and the way to use them for this should become clear.
 
rohit raja
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Moores wrote:The question already says how to do it: with session attributes. Read up on those in your textbook -or whatever learning materials you have-, and the way to use them for this should become clear.


Actually i already gone through the text book and i framed it also but my actual problem is that i am taking input in first servlet and through request dispatcher i am passing it to second servlet and there its checking for value initialized or not then i will take input in second servlet at that time how the first servlet will check whether the value in second is initialized or not. should i again send use request dispatcher?
 
Tim Moores
Saloon Keeper
Posts: 7585
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, I see nothing in the problem description that would require a request dispatcher. It states that each servlet should check whether the other has been called already. It says nothing about one calling the other.
 
rohit raja
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Moores wrote:Actually, I see nothing in the problem description that would require a request dispatcher. It states that each servlet should check whether the other has been called already. It says nothing about one calling the other.



Can you please send me the code? please
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please let us know when a question is a school assignment. That way no one wastes time trying to find out why it doesn't make much real-world sense.

Also read NotACodeMill.
 
rohit raja
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Please let us know when a question is a school assignment. That way no one wastes time trying to find out why it doesn't make much real-world sense.

Also read NotACodeMill.



Ok i will do it.thank you for suggesting me
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic