• Post Reply Bookmark Topic Watch Topic
  • New Topic

calling a servlet from a jsp

 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a jsp with the following form tag:

My web.xml file looks like this:

When I hit submit, controller is never called. The screen does get repainted. The url never changes, so it doesn't appear that controller is ever called. Controller uses RequestDispatcher.forward( req , res ) to move on from this screen. Any ideas?
 
sandy gupta
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do i see a /?controller
in your servlet url pattern where ?=space
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that is the formatting of UBB. There is no space in the web.xml file. Other jsps in the same folder as this one work using the same action attribute.
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I may have found the problem. There is a quote missing at the end of databaseEnroll. I will test it tomorrow and let all of you know the results.
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The missing quote was the problem.
 
Ming Chen
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Change <FORM NAME="databaseEnroll ACTION="controller" METHOD="post">
To <FORM NAME="databaseEnroll" ACTION="servlet/controller" METHOD="post">
always use servlet/servletClass
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ming Chen:
Change <FORM NAME="databaseEnroll ACTION="controller" METHOD="post">
To <FORM NAME="databaseEnroll" ACTION="servlet/controller" METHOD="post">
always use servlet/servletClass

The problem was the quote. I have controller mapped to the servlet in the web.xml folder, so ther is no need to set "servlet/controller" in the ACTION attribute.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!