struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kris Schneider <k...@dotech.com>
Subject Re: Actions invoked by links have more flexibility than those driven by forms?
Date Thu, 02 Jan 2003 20:49:25 GMT
For a single parameter:

<html:hidden name="myBean" property="id"/>

But there's no direct way to use a Map of parameters ala <html:link>. One
possibility (with JSTL):

<c:forEach var="entry" items="${paramMap}">
  <input type="hidden" 
         name="<c:out value='${entry.key}'/>"
         value="<c:out value='${entry.value}'/>">
</c:forEach>

Quoting John Munsch <jmunsch@pdxinc.com>:

> With an html:link I can embed a reference to a parameter or multiple
> parameters:
> 
> 
> <html:link paramId="id" paramName="myBean" paramProperty="id" 
> forward="/test">Click Me</html:link>
> 
> 
> Note that this will call whatever /test maps to with "?id=<some #>"
> after it. And if I create /test as a global forward and map that to some
> action mapping (e.g. /test points to /test.do) then an action gets
> called with either one or more parameters passed through to it.
> 
> On the other hand, with html:form I don't seem to have the same
> functionality. I don't see a way to refer to a parameter or set of
> parameters in the html:form tag so that I can pass through parameters
> that way. So I pretty much have to pass through anything I want to send
> to an action invoked through a form using the ActionForm that it gets
> when it is called.
> 
> My question is: Why? Since the action for the form is written into the
> HTML in much the same fashion as a link is written, why can't you make
> reference to one or even multiple parameters that you want to be written
> into that URL via the same mechanisms that are available through
> html:link? Why not:
> 
> <html:form paramId="id" paramName="myBean" paramProperty="id" 
> action="/test">
> 
> Or am I missing something completely?
> -- 
> John Munsch <jmunsch@pdxinc.com>
> PDX, Inc.
> 
> 
> --
> To unsubscribe, e-mail:  
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
> 


-- 
Kris Schneider <mailto:kris@dotech.com>
D.O.Tech       <http://www.dotech.com/>

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message