Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

HTML form action to call servlet, no scriptlets  RSS feed

 
margaret gillon
Ranch Hand
Posts: 335
6
Linux Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have made a html form in a JSP file called addbook.jsp for an assignment that goes to a servlet for processing. The form works but the instructor told me to move the action to the submit button and I cannot get the revised form to work , or else I am misinterpreting the instructors comments.




I took the action out of the top so I just have


And have tried many different things in the button such as the line below. When the submit button is pressed the browser just reloads an empty form.




 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll have to get clarification from the instructor. input elements do not have an action attribute (except in HTML5, where the formaction attribute is not in widespread use yet).
 
margaret gillon
Ranch Hand
Posts: 335
6
Linux Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Bear. I am contacting the instructor.
 
Greg Charles
Sheriff
Posts: 3014
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think your instructor might have meant that you don't need to pass an action parameter with your form action when you already have one defined on your submit button.

So keep:

... but change the form tag to:



 
margaret gillon
Ranch Hand
Posts: 335
6
Linux Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the clarification. The servlet works nicely now.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!