Hi. My website use struts and tiles. I use this link to link to register form:
<a href='<s:url action="register" namespace="/vtv" />' >Register</a>
here is the register.jsp:
<s:form namespace="/vtv" action="register">
<s:textfield label="Username" name="username" />
<s:textfield label="Password" name="password" />
</s:form>
In action, i insert the user :
public String execute() {
String retVal = ERROR;
try {
MemberDAO.InsertUser(mo);
retVal = SUCCESS;
}
} catch (Exception e) {
retVal = ERROR;
}
return retVal;
}
in tiles file, i define:
<definition name="vtv.register" extends="basic">
<put-attribute name="content" value="/modules/register/register.jsp" />
</definition>
and in struts file:
<package name="Register" namespace="/vtv" extends="struts-default">
<result-types>
<result-type name="tiles"
class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
<action name="register" class="vtv.action.RegisterAction">
<result name="success" type="tiles">vtv.register</result>
<result name="error" type="tiles">vtv.error</result>
</action>
</package>
My problem is how can i redirect to register page using link
<a href='<s:url action="register" namespace="/vtv" />' >Register</a>
without doing the execute in action ? How can i know if this is redirect or submit ?