You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sudipta Sarkar <su...@usa.net> on 2002/03/22 16:53:22 UTC
Re: [Re: how to dynamically change form in a tag]
The solution you said works.
but
<html:form action="<%= request.getParameter("id") %>"> does not work
although
<% String id = (String)request.getParameter("id"); %>
<html:form action="<%= id %>">
works.
Is there anything that I am doing wrong in case 1.
Thanks
Sudipta
"Nicolas De Loof" <ni...@cgey.com> wrote:
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>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: [Re: how to dynamically change form in a tag]
Posted by Nicolas De Loof <ni...@cgey.com>.
Does
<html:form action="<%= (String) request.getParameter("id") %>">
work ?
The solution you said works.
but
<html:form action="<%= request.getParameter("id") %>"> does not work
although
<% String id = (String)request.getParameter("id"); %>
<html:form action="<%= id %>">
works.
Is there anything that I am doing wrong in case 1.
Thanks
Sudipta
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: [Re: how to dynamically change form in a tag]
Posted by Jay sissom <js...@toybox.uits.indiana.edu>.
The <html:form...> tag and the <%= ... %> tags are server tags. They get
compiled into Java code that compiles on the server. From what I've
discovered, you can't nest these tags. I'm sure someone will correct me
if I'm wrong. I have found that you can nest server tags within browser
tags like this:
<input type="text" name="junk" value="<%= v %>">
In tomcat, when a JSP is run, the compiled version and source code is put
into a work directory. When I run tomcat under jbuilder, the work
directory is within my project. If you find the source code for your
example below, you'll see that the value "<%= request.getParameter... %>"
is being put in the action property, not the evaluated version.
Again, this is from my poking around on tomcat. I haven't read the
servlet spec about this so I don't know for sure that this happens on all
servlet containers.
To boil it all down, you can't nest server compiled tags. That's why your
solution doesn't work.
Jay
On Fri, 22 Mar 2002, Sudipta Sarkar wrote:
> The solution you said works.
> but
> <html:form action="<%= request.getParameter("id") %>"> does not work
> although
> <% String id = (String)request.getParameter("id"); %>
> <html:form action="<%= id %>">
> works.
> Is there anything that I am doing wrong in case 1.
>
> Thanks
> Sudipta
>
> "Nicolas De Loof" <ni...@cgey.com> wrote:
> 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>
>
>
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>