my dog learned polymorphism
The moose likes Struts and the fly likes Is this one HttpRequest cycle ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Is this one HttpRequest cycle ?" Watch "Is this one HttpRequest cycle ?" New topic

Is this one HttpRequest cycle ?

Raj Ohadi
Ranch Hand

Joined: Jun 30, 2006
Posts: 316
In "main.jsp" there are some radio button, checkbox, etc, when you click "submit", it calls "SubmitAction" action class and forward back to "main.jsp" again.

So it is like: main.jsp--->>main.jsp From the "1st" main.jsp to the "2nd" main.jsp, is it ONE HttpRequest cycle ? The rason why I ask this is --

After user click submit" the main.jsp will be reloaded but with newly processed information.. I want to use "request.getParamter("...")" in my main.jsp to retrieve what users picks for the first time on main.jsp before he clicks "submit". I know I can just try, but I want to make sure conceptually it is one HttpRequest cycle or not.

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
When the user types the URL ..../main.jsp and the JSP tags are interpreted and rendered into HTML, that's one request. When the user clicks the submit button, that causes the browser to send another request to the server. Your SubmitAction class reads that request and then forwards to main.jsp, which has access to that request object as it's rendering the HTML to be sent back to the browser.

So, from the time the user first types in the URL to the page being displayed a second time, there are two requests. From the time the user presses the submit button until the page is redisplays, there is one request.

Does that make sense? I hope I haven't added more confusion.

Consultant, Sima Solutions
Raj Ohadi
Ranch Hand

Joined: Jun 30, 2006
Posts: 316
I agree. Here's the link:
subject: Is this one HttpRequest cycle ?
It's not a secret anymore!