PDA

View Full Version : incorrect form action...


nyte3k
Sep 13th, 2007, 09:51 AM
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.

<%@ 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




<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.

nyte3k
Sep 13th, 2007, 01:03 PM
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.


<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.