How to pass a parameter to a TileAction controller?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to pass a parameter to a TileAction controller?

Sam Hokin-3
Hiya, devs. I've written a controller for a list analysis tile, and I'd like to have a parameter passed in rather than having it
hardcoded. I've tried this in webapp/resources/struts-config-model.xml:

<!-- MEME analysis -->
<action path="/initMemeAnalysis" type="org.ncgr.intermine.web.MemeController">
        <param name="serviceURL">http://intermine.ncgr.org/opal2/services</param>
</action>

 From my reading of some tile docs, this is supposed to result in the calling of a setParams(Map map) method in the associated
TilesAction class, where the name is the map key.

I also tried throwing it in a <context-param> block in webapp/resources/webapp/WEB-INF/web.xml, and using
request.getServletContext().getInitParameter() in the controller class, but that didn't work, either.

Any suggestions? I haven't been able to find an example of doing this in the various distro mines.
_______________________________________________
dev mailing list
[hidden email]
https://lists.intermine.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to pass a parameter to a TileAction controller?

Justin Clark-Casey-2
Hi Sam.  I suspect you're looking at Struts 2 documentation rather than Struts 1 [1]?  InterMine is still using 1.3.10.

I think you'll need to use <set-property> instead, as described at [2] and [3].

Yeah, no action does this in Intermine currently and I haven't tried this myself.  <set-property> is used in a few places but for other config stuff.  It seems
a pain to have to subclass <action-mapping> as described in the references and I suspect you'll have to patch
intermine/webapp/main/resources/webapp/WEB-INF/struts-config.xml directly.

[1] http://stackoverflow.com/questions/11790100/providing-action-parameter-value-in-struts-config-in-struts1
[2] http://stackoverflow.com/questions/13248696/in-struts1-how-to-use-set-property-tag-inside-action-tag
[3] http://www.mail-archive.com/struts-user@.../msg21396.html

--
Justin Clark-Casey, Synbiomine/InterMine Developer
http://synbiomine.org
http://twitter.com/justincc

On 02/09/16 21:32, Sam Hokin wrote:

> Hiya, devs. I've written a controller for a list analysis tile, and I'd like to have a parameter passed in rather than having it hardcoded. I've tried this in
> webapp/resources/struts-config-model.xml:
>
> <!-- MEME analysis -->
> <action path="/initMemeAnalysis" type="org.ncgr.intermine.web.MemeController">
>     <param name="serviceURL">http://intermine.ncgr.org/opal2/services</param>
> </action>
>
> From my reading of some tile docs, this is supposed to result in the calling of a setParams(Map map) method in the associated TilesAction class, where the name
> is the map key.
>
> I also tried throwing it in a <context-param> block in webapp/resources/webapp/WEB-INF/web.xml, and using request.getServletContext().getInitParameter() in the
> controller class, but that didn't work, either.
>
> Any suggestions? I haven't been able to find an example of doing this in the various distro mines.
> _______________________________________________
> dev mailing list
> [hidden email]
> https://lists.intermine.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
[hidden email]
https://lists.intermine.org/mailman/listinfo/dev
Loading...