Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

init parameters

 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I wrote the following code:



My web.xml looks like this:



My Questions are:

1). System.out.println(value); is working fine and printing the value on to the console but when I try to display the value onto the browser(in doPost() method) it's not displaying?

2). When I wrote the following code(what is now in init() method) in doPost(), it's not even printing onto the console?
value = getServletConfig().getInitParameter("JndiName");
System.out.println(value);

Can anyone tell me why?

Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Arjun Reddy:
System.out.println(value); is working fine and printing the value on to the console but when I try to display the value onto the browser(in doPost() method) it's not displaying?
I see no place in your code where you are writing the value to the response.
 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, but please bear with me. This should be right right?
out.println(value); but the thing is nothing seems to be printing onto the browser.

Thanks.
[ July 11, 2008: Message edited by: Arjun Reddy ]
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Change this

out.println("<h2>value</h2>");


to

out.println("<h2>"+value+"</h2>");


This may fix the problem....
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Arjun Reddy:
Sorry, but please bear with me. This should be right right?
out.println(value); but the thing is nothing seems to be printing onto the browser.
That code appears nowhere in your servlet.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What actually shows up on the browser? If the browser screen is blank, perhaps the servlet buffer has not actually been written.

Try closing the output stream at the end of the doPost method.

Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic