You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bill Page <Bi...@DigitalGarden.com> on 2002/03/21 23:40:32 UTC
how to dynamically change form in a tag
I can't seem to change the action on an <html:form> dynamically
I have this:
<html:form action="/AccountMaint">
I want to use
<html:form action="/AccountMaint">
or
<html:form action="/CreateAccount">
I tried to use an if around it
<%
if( something) {
%>
<html:form action="/AccountMaint">
<%
}
else {
%>
<html:form action="/CreateAccount">
<%
}
%>
but the parser complained
Parse Error in JSP page: The page '/custom/docs/AccountMaint.jsp' did not
close the '__tag_form_4' tag. allaire.jrun.jsp.ParseException: The page
'/custom/docs/AccountMaint.jsp' did not close the '__tag_form_4' tag.
put the same if structure at the end to include two </htm:form> tags (both
the same) and got
Parse Error in JSP page: The page '/custom/docs/AccountMaint.jsp' did not
close the '__tag_form_3' tag. allaire.jrun.jsp.ParseException: The page
'/custom/docs/AccountMaint.jsp' did not close the '__tag_form_3' tag.
bill page
billp@digitalgarden.com
Digital Garden Software, Inc.
856 US Hwy 206 Bldg B Ste 15
Hillsborough, NJ 08844
908.904.0664
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: how to dynamically change form in a tag
Posted by Nicolas De Loof <ni...@cgey.com>.
JSP Tags use an XML syntax, so you must have the same number of opening and
closing "html:form" jsp tags in your jsp. This is why your JSP engine
failed.
acording to struts-form.tld, action attribute in html:form tag can be JSP
computed. Try this:
<%
String actionPath;
if( something) {
actionPath =" /AccountMaint";
}
else {
actionPath =" /CreateAccount";
}
%>
<html:form action="<%= actionPath %>">
...
</html:form>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>