I was trying to understand the use of <c:url> tags, I looked for a example in here.
But i did not understand the flow of execution in this page at all
Could you please explain it?
Sorry for the unindented code. I indented it now.
But when the page is first loaded, only the table is created, and ON clicking the submit button the c:url thing is happening. I mean why is the curl thing not happening when the page is loaded(It would have printed null anyhow)?? what is THE condition that is stopping the execution of the c:url until the submit button is clicked.
May be this question is simple and stupid. I think this is because i don't have an prior experience in development
But when is the page loaded for the second time I mean to ask when and how??
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35446
9
posted
0
That happens when the form is submitted - since the form tag has no action attribute, it submits to itself.
Sony Agrawal
Ranch Hand
Joined: Oct 04, 2009
Posts: 143
posted
0
Ulf Dittmer wrote:The first time the page is accessed it would be through a GET, not a POST
Ulf Dittmer wrote:since the form tag has no action attribute, it submits to itself.
What i understood from these statements is that when a from without action attribute is first loaded , it is GET. And when it is submitted it would return the same page with a POST request. (Correct me if i am wrong. i have a feeling that this is wrong.)
With the above assumption i tried this code in a JSP.
EVEN after submission the method returned is GET
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35446
9
posted
0
What i understood from these statements is that when a from without action attribute is first loaded , it is GET.
It has nothing to do with whether or not a form in a JSP page has an action attribute. Any URL entered in a browser is accessed via GET.
With the above assumption i tried this code in a JSP.
EVEN after submission the method returned is GET
You can't just randomly omit attributes and expect things to work still. If you want a POST, then you need a method attribute that says so. In the absence of a method attribute, the default method is GET.
Sony Agrawal
Ranch Hand
Joined: Oct 04, 2009
Posts: 143
posted
0
Ulf Dittmer wrote:The first time the page is accessed it would be through a GET, not a POST, so the whole code block isn't executed.
Then how is the request becomes post when the form is submitted ??
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35446
9
posted
0
That's what the method attribute is for that I mentioned.