• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

request.getAttribute returning null

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Marshal
Posts: 67447
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Java code in the JSP is just for debug purposes, right?

How do you know it's null?
 
Greenhorn
Posts: 14
Angular Framework Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, but I am still get a null pointer exception when I run the .jsp on tomcat.
 
Awet Haddis
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Posts: 67447
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why aren't you using the JSTL to handle internationalization?
 
Awet Haddis
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Posts: 67447
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JSTL handles all that for you.
 
Life just hasn't been the same since the volcano erupted and now the air is full of tiny ads.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic