This is my first shot at using 100% struts tags for my forms. I'm missing something.
snippet from jsp:
<html:form action="pmregister" method="post" focus="firstName" name="pmRegisterForm"
type="com.je.struts.action.PMRegisterForm">
<!--<form action="pm/pmregister" method="post"> -->
<P>First name * : <html:text property="firstName" size="20"
maxlength="15"/></P>
<P>Last name * : <html:text property="lastName" size="20"
maxlength="20"/></P>
<P>Street * : <html:text property="street" size="20" maxlength="20"/></P>
<P>City * : <html:text property="city" size="20" maxlength="20"/></P>
<BR>
<BR>
<html:submit value="Submit" />
<!--</form> -->
</html:form>
You will notice the commented previous old form tag. Here's what the rendered "real"
html looks like:
<form name="pmRegisterForm" method="post" action="/webapp">
<!--<form action="pm/pmregister" method="post"> -->
<P>First name * : <input type="text" name="firstName" maxlength="15"
size="20" value=""></P>
<P>Last name * : <input type="text" name="lastName" maxlength="20"
size="20" value=""></P>
<P>Street * : <input type="text" name="street" maxlength="20" size="20"
value=""></P>
<P>City * : <input type="text" name="city" maxlength="20" size="20"
value=""></P>
<BR>
<BR>
<input type="submit" value="Submit">
<!--</form> -->
</form>
<script type="text/javascript" language="JavaScript">
<!--
var focusControl = document.forms["pmRegisterForm"].elements["firstName"];
if (focusControl.type != "hidden") {
focusControl.focus();
}
// -->
</script>
Something is not right here. Why is my action equal to the context? When I submit
the form, I'm taken to the home page of my application. The struts action does NOT
run.
Here's my struts XML:
<form-bean
name="pmRegisterForm"
type="com.je.struts.action.PMRegisterForm">
</form-bean>
.....
<action path="/pmregister"
type="com.je.struts.action.PMRegisterAction"
scope="request"
name="pmRegisterForm"
input="/tmpl_main.jsp?page=/main/pm/regform.jsp&page_title=Property Management
Services"
validate="true">
<forward name="fees"
path="/tmpl_main.jsp?page=/main/pm/fees.jsp&page_title=Property Management
Services"/>
</action>
I have /pm/* mapped to the main struts action servlet in web.xml.
<servlet-mapping>
<servlet-name>ActionServlet</servlet-name>
<url-pattern>/pm/*</url-pattern>
</servlet-mapping>
I also have many more mappings to the same servlet. I'm not just using /go/*.