Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Performance ....

 
Bala Krishniah
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to validate the user input and depending on that I need to call different JSP. I need to do this 3 times. ie if the first time the data is not valid, I have to call the 2nd jsp and if the 2nd time also the data is not valid, I nedd to call the 3th JSP.
(1)If it ok if I make the check in the same servlet everytime (by calling the same servlet while 'submit'ing the data)
(2)or should I have three different servlets, each overriding the same method, to display the corresponding JSP.
i.e
method1()::Servlet1
method1()::Servlet2 extends Servlet1
method1()::Servlet3 extends Servlet2
Which is the best way of doing. And,
In case (1), what is the over of looing through the options to check from which page the Servlet has been called and also to call the corresponding JSP.
In case (2) What is the overhead of having three servlets just to override a method to call the corresponding JSP
Thanks
 
ARS Kumar
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Have one servlet which handles different conditions and calling the respective JSP(s) seems to be logical to me.
You could have one main servlet which will get called after the user enters the data. This main servlet can call other servlets or JSP(s) or plan java packages that can be used to validate the input.
Regards
------------------
Regards
ARS Kumar
Sun Certified Java 2 Programmer.
 
Randall Twede
Ranch Hand
Posts: 4481
3
Java Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

ie if the first time the data is not valid, I have to call the 2nd jsp and if the 2nd time also the data is not valid, I nedd to call the 3th JSP.

It looks like you only have to do it twice, not three times.
You could have two identical servlets(with different names) except for calling a different JSP. There would be no performance overhead, in fact they wouldnt have to do the check to determine which JSP to call.
I wouldnt have one extend the other I dont think though. At least I dont think you have to.
Either method will work. I'm not even sure which way I would go. Although I'm inclined to think I would have made just one servlet.
------------------
Dont blindly believe everything I say.

[This message has been edited by Randall Twede (edited March 09, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic