Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Alternate Method to post request from Servlet to Jsp

 
Jilesh Lakhani
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wish to send control from my Servlet to Jsp.. with some parameters.. however I've tried using sessions but due to perfomace issue I've changed it to POST.... which results in Slow loading of JSP page...

Could you suggest me any other method, in which that can be done..
NOT A FORM POST or setting the variables in session..
 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it really from Servlet to JSP? As in:

Servlet -> JSP ?

Ok, have you triede response.setAttribute(String, Object) ?
 
Jilesh Lakhani
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it is Servlet -> JSP...

so, if I use response.setAttribute(String, object)... I'll have to cast it in JSP.. and it will be response.getAttribute(String)
right ??
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've tried using sessions but due to perfomace issue I've changed it to POST


What performance isssues did you have while using session and how did you determine that sessions were to blame?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64967
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Yound Devil",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff
 
Jilesh Lakhani
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, during the testing phase.. the process reached.. 60% and after reducing some uncessary parameters...from session to Post... the process reached to 50%...
there was 10% difference in the Process fulxtuation..
NOTE: Above was the load testing done for 30 concurrent users on P4 machine with 1GB Ram..

However I've also have to keep in mind that the USER Processing is fast enough.... while using POST action in a servlet...the USER access tends to become bit slow.... and I guess we all know the reasoning for that..

my target is about 110 concurrent users.....
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64967
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Yound Devil", My request that you change your display name to adhere to JavaRanch standards was not a suggestion. Valid display names are mandatory for participation on the Ranch. Please change your display name as instructed prior to your next post.

Be aware that accounts with invalid display names are removed.

bear
JavaRanch Sheriff
 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jilesh Lakhani
I'm a little confused when you talk about Post. When it comes to JSP and Servlets, there are two common things that I can think of that is frequently used. Those are session and request. There are other things like application but I don't bother myself with those since my brain is too small learn all those things. To get back to your problem, have you heard of Expression Language(EL)? Request/session scoped variables can be accessed through them like this:


${requestAttributeName}


I'm not too sure what the performance gains are though. Also, to get the attribute in JSP, it's not response.getAttribute(), it's request.setAttribute. Yes, you will need to cast it down to your desired object if you use scriptlets:


(MyClass)request.getAttribute("attributeName");


Gosh... I'm also getting anxious about how my app would perform once publish on the web... Geeez...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic