wood burning stoves 2.0*
The moose likes Servlets and the fly likes Alternate Method to post request from Servlet to Jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Alternate Method to post request from Servlet to Jsp" Watch "Alternate Method to post request from Servlet to Jsp" New topic
Author

Alternate Method to post request from Servlet to Jsp

Jilesh Lakhani
Greenhorn

Joined: Jul 26, 2006
Posts: 3
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

Joined: Sep 18, 2005
Posts: 746
Is it really from Servlet to JSP? As in:

Servlet -> JSP ?

Ok, have you triede response.setAttribute(String, Object) ?


SCJP 1.5
http://devpinoy.org/blogs/lamia/ - http://everypesocounts.com/
Jilesh Lakhani
Greenhorn

Joined: Jul 26, 2006
Posts: 3
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

Joined: Dec 11, 2004
Posts: 13410

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?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61008
    
  65

"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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jilesh Lakhani
Greenhorn

Joined: Jul 26, 2006
Posts: 3
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

Joined: Jan 10, 2002
Posts: 61008
    
  65

"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

Joined: Sep 18, 2005
Posts: 746
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...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Alternate Method to post request from Servlet to Jsp