This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Servlets and the fly likes request.getAttribute returning null Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "request.getAttribute returning null" Watch "request.getAttribute returning null" New topic
Author

request.getAttribute returning null

Awet Haddis
Greenhorn

Joined: Jan 25, 2011
Posts: 11
Hi guys, I'm trying to develop my first web application. I am having trouble with my servlet; in particular, my request.getAttribute method
for my property file is returning null. Here is my code:

uploadData.java


In my uploadData.jsp


Thank you in advance
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56192
    
  13

The Java code in the JSP is just for debug purposes, right?

How do you know it's null?


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
T Jung
Greenhorn

Joined: Feb 08, 2011
Posts: 4

In case you want to print the value of the property, you should change the JSP like this:
(notice there is no ";" in the second line)

Awet Haddis
Greenhorn

Joined: Jan 25, 2011
Posts: 11
Thank you, but I am still get a null pointer exception when I run the .jsp on tomcat.
Awet Haddis
Greenhorn

Joined: Jan 25, 2011
Posts: 11
Some background...

I have a page called uploadData.jsp. I want to provide the French and English versions of this page for the user, thus I have variables in my .jsp that
I will be replaced from the ahpd_fr.properties file. Here is the entire .jsp file. It is not complete but it is enough to debug this one task.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56192
    
  13

Why aren't you using the JSTL to handle internationalization?
Awet Haddis
Greenhorn

Joined: Jan 25, 2011
Posts: 11
My manager suggested this approach. I am a mechanical engineering student on a software development co-op so I am hesitant
to clear my own path. Either way, if I use the JSTL for internationalization, I would still need to make the translations myself and
pull them from a properties file, would I not?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56192
    
  13

The JSTL handles all that for you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: request.getAttribute returning null
 
Similar Threads
Why do I get "Cannot forward after response has been committed"?
GET Method Working But POST is not
problem implementing iReports with servlets
Getting the Servlet output in a JSP file
sending email in servlet