[jboss-user] [JBoss Seam] - Re: s:link problem

stu2 do-not-reply at jboss.com
Thu May 17 13:56:09 EDT 2007


"Stateless Bean" wrote : hi,
  | i got problem with s:link i need to create in <h:dataTable elements with s:link and need to incject him param like:
  | 
  |   | <s:link action='#{stsb.method("12")}'>
  |   |      <img src="#{defence.imageSrc}" style="border: none;" />
  |   | </s:link>
  |   | 
  |   | public String method(String elem) {}
  |   | 
  | 
  | but i must to set my "12" numer from bean with EL, is this well formed? does this work?
  | 
  |   | <s:link action='#{stsb.method("#{sfsb.myparam}")}'>
  |   |      <img src="#{defence.imageSrc}" style="border: none;" />
  |   | </s:link>
  |   | 
  | 
  | or maybe is better way to inject=rendered elem?
  | 

One very straightforward way that works reliably is to use f:param and @RequestParameter.

I've found it to be simpler than trying to get the el parameter stuff to work (or the DataModelSelection for that matter) plus you can unit test it (El parameters don't work from SeamTest currently)

Anyway, here's how it looks in the xhtml:

<s:link value="del" action="#{catalogMapping.removeMapping}">
  | 	<f:param name="columnNumberToUnmap" value="#{column.rawColumn.columnNumber}" />
  | </s:link>
  | 

Your image tag would be a peer of the f:param.  And in your bean, just mark a variable with @RequestParameter with a name that matches your parameter name.  Done.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4046580#4046580

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4046580



More information about the jboss-user mailing list