• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EL implicit object pageContext

 
Richard Rex
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I've tried using pageContext to print the method property of the request, but it seems that I'm missing something. I can't print the request method property.

Here's my Code:

1. Sample.html - this forwards to the TestBean.jsp upon clicking Submit
--------------------------------------------------------------------
<html>
<body>
<form action="TestBean.jsp">
Name: <input type="text" name="name">
ID #: <input type="text" name="empID">

First food: <input type="text" name="food">
Second food: <input type="text" name="food">
<input type="submit">
</form>
</body>
</html>
--------------------------------------------------------------------------

2. TestBean.jsp - makes use of the param, paramValues, and pageContext implicit objects. I put two versions for printing the request property method. The first one is a scriptlet and the other one uses pageContext implicit object. But the output only displays the GET for the scriptlet version and not for the EL version.
--------------------------------------------------------------------------
<html>
<body>
Request param name is: ${param.name} <br>
Request param empID is: ${param.empID} <br>
Request param food is: ${param.food} <br>

First food request param: ${paramValues.food[0]} <br>
Second food request param: ${paramValues.food[1]} <br>

Request param name: ${paramValues.name[0]} <br>
Method is (scriptlet version): <%= request.getMethod() %> <br>
Method is (EL version): ${pagContext.request.method}
</body>
</html>
--------------------------------------------------------------------------

Any ideas?
 
Frederic Esnault
Ranch Hand
Posts: 284
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi !

Just wondering, is this a typo when you typed here or is it written like this in your JSP ?

${pagContext.request.method}

If it's like this in your JSP, try to correct it : ${pageContext.request.method}
 
Saurabh Chaubey
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Richard,
I think it is a typo by you :Method is (EL version): ${pagContext.request.method} should be Method is (EL version): ${pageContext.request.method}
 
Saurabh Chaubey
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Richard,
I think it is a typo by you :Method is (EL version): ${pagContext.request.method} should be Method is (EL version): ${pageContext.request.method}

Saurabh
 
Richard Rex
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Frederick and Saurabh,

Yes, this was my bad! I didn't noticed that..

Thanks for pointing that out!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic