aspose file tools*
The moose likes Servlets and the fly likes init parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "init parameters" Watch "init parameters" New topic
Author

init parameters

Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 629
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.


Be Humble... Be Nice.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61624
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 629
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

Joined: May 29, 2008
Posts: 445

Change this

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


to

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


This may fix the problem....


Never try to be a hard-worker. Be a smart-worker.
My Blog
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61624
    
  67

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

Joined: Mar 22, 2000
Posts: 12823
    
    5
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: init parameters