Announcement Announcement Module
Collapse
No announcement yet.
incorrect form action... Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • incorrect form action...

    I have recently started using Spring form tag library, but i've noticed the form action is incorrect now, it points to the actual location of the form.

    //This is the jsp page.

    Code:
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
    <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
    <html>
    <head>
    <title>Insert title here</title>
    </head>
    <body>
    Initial Page
    
    <form:form method="post" commandName="newMemberCommand">
    	<form:input path="companyName"/>
    	<input type="submit" value="Try It Now"/>
    </form:form>
    </body>
    </html>

    //This is how it is rendered

    Code:
    <html>
    <head>
    <title>Insert title here</title>
    </head>
    <body>
    Initial Page
    
    <form id="newMemberCommand" method="post" action="/Phonelog/WEB-INF/jsp/index.jsp">
    	<input id="companyName" name="companyName" type="text" value=""/>
    	<input type="submit" value="Try It Now"/>
    </form>
    
    </body>
    </html>

    Any ideas why? Is it now required to set the form action? using the older spring:bind tags, this wasn't necessary for me to do.

  • #2
    I figured it out. I set the action as the same url that was used to access the controller in the first place.

    .../signup.htm would access the controller and show the formView.

    Code:
    <form:form method="post" commandName="newMemberCommand" action="signup.htm">
    	<form:input path="companyName"/>
    	<input type="submit" value="Try It Now"/>
    </form:form>
    submitting the form successfully directs to the successView.

    Anyone know why this wasn't required using the old spring:bind method? Just wondering.

    Comment

    Working...
    X