request.getAttribute Not Displaying Anything In JSP
Somnath Mallick
Ranch Hand
Joined: Mar 04, 2009
Posts: 471
posted
0
Hi everyone,
I have servlet send a request parameter to a JSP, and i am just extracting the values from the request object in the JSP and displaying it. But the values aren't getting printed at all. I debugged the code and i found the request object is coming to the JSP loaded with the values but its not printing anything. Here is my JSP:
Somnath Mallick
Ranch Hand
Joined: Mar 04, 2009
Posts: 471
posted
0
Well I figured out what the mistake was. Changed the scriptlet tag to expression tag. And its printing the values, except the "percentage" value. Its coming to the jsp into the request object, but somehow its printing null! My updated JSP:
My Servlet:
Could you tell me how come my two values are getting printed and not the third???
Its just something i tried out. Actually my main intention was to learn calling an EJB from a servlet and displaying the result in an JSP. I hardly use JSP's. If the JSP specification and all have changed a lot, i would be glad to look into it. Please give me some details...
I looked at some of documents in Google and found out that JSP 2.0 makes extensive use EL, which comes from JSTL. Now, i have never used JSTL, so would i be able to learn JSP 2.0 without knowing JSTL 1.0? Or should i go through JSTL as well before digging into JSP 2.0?
Somnath Mallick wrote:... EL, which comes from JSTL.
That is not correct. As of JSP 2.0, the EL is evaluated by the core JSP engine and is independent of the JSTL.
Now, i have never used JSTL, so would i be able to learn JSP 2.0 without knowing JSTL 1.0?
JSTL 1.0 is for JSP 1.2. If you are using JSP 2.x, you should be using JSTL 1.1 or 1.2.
And without the JSTL, you'll need to resort to using scriptlets in your pages to do pretty much anything. Bad idea. Very bad idea. Man up and learn JSTL and step into the modern world of JSP.
Or should i go through JSTL as well before digging into JSP 2.0?
Learn the JSP 2.0 EL and JSTL in conjunction with each other. They go together like hand and glove.