Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
    Bookmark Topic Watch Topic
  • New Topic

No output in jsp  RSS feed

 
pramod talekar
Ranch Hand
Posts: 367
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi ,
The below code doesn't show anything on the screen:

This index.jsp is under WebContent folder but outside WEB-INF.



It's web.xml : -



It's servlet pramod.java in default package :



Server log:


It does pring index.jsp's contents when there is no servlet (or when I don't write form<> tag) but otherwise there is an empty screen.
My main.jsp in WebContent outside WEB-INF contains "hihihh".

I'm not sure what we need to write in action parameter in index.jsp, is it the name of the servlet class, or something else.
I tried out writing 'pramod' , 'test' but no use.
Please advise.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66154
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Is there anything in the response being sent to the browser? Just looking at the browser display doesn't tell you much.
 
pramod talekar
Ranch Hand
Posts: 367
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi Bear,

This is my main.jsp, I thought it would print at least hello

<body>

hello

<%= request.getAttribute("name") %>
</body>


So is
<form action="pramod" method="post">
right ?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66154
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
You didn't answer my question.

And that does not match the code that you posted above. Why is that?

And why are you still putting scriptlets into JSPs 10 years after they've bee replaced with JSTL and EL?
 
pramod talekar
Ranch Hand
Posts: 367
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Report post to moderator
I didn't understand your first question on response in browser and made hhihh to hello to make it meaningful.
It's just for test purpose.

All I'expecting is index.jsp with 'hi' and 'go' button but even that is not appearing and the browser screen is plain white and there is no error in server log.
Also, not sure what I need to write in the Action parameter of the Form tag.
 
pramod talekar
Ranch Hand
Posts: 367
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Report post to moderator
I thought the response would contain at least 'hi' if not the 'go' button to the browser for index.jsp's execution.
 
pramod talekar
Ranch Hand
Posts: 367
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Report post to moderator
This project is not showing any output for any jsp now.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66154
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
You need to learn basic debugging if you are going to work in this area.

The View Source of the browser will show the body of the response as sent from the server.

Have you checked the logs for exceptions?

What else have you done to debug this?
 
pramod talekar
Ranch Hand
Posts: 367
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Report post to moderator
I did check the browser source code in Chrome which was blank.
Don't understand what is the problem with index.jsp excluding <form> tag.
Why can't it print even 'hi'.

I had also run debug on server option, same reply.

Could you please tell me if the action tag value is right or wrong.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66154
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
No, it's not. See your other thread. Closing this one.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!