struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daoyue Ming" <>
Subject Re: how to get config info from portlet.xml in struts2 action
Date Wed, 07 Jan 2009 01:56:02 GMT
Here is my code:


    <package name="default" extends="struts-portlet-default" namespace="/view">
        	<interceptor name="business"

             <interceptor-stack name="simplePortletStack">
                <interceptor-ref name="portletState"/>
                <interceptor-ref name="exception" />
                <interceptor-ref name="servlet-config" />
                <interceptor-ref name="params">
                	<param name="excludeParams">dojo\..*,^struts\..*</param>
                <interceptor-ref name="conversionError" />
                <interceptor-ref name="portletAware"/>
                <interceptor-ref name="business"/>
        <action name="linkCategories" class="linkCategoryAction" method="list">
            <interceptor-ref name="simplePortletStack"/>

public class LinkCategoryAction extends BaseAction implements
PortletContextAware {

public void setPortletContext(PortletContext portletContext) {
    	this.portletContext = portletContext;

public String list() {
        String categoryId = portletContext.getInitParameter("categoryId");
        Enumeration enu = portletContext.getInitParameterNames();
        return SUCCESS;

here only extract some important points, what I get from
getInitParameterNames enumeration is all the config from web.xml not

On Wed, Jan 7, 2009 at 2:46 AM, Nils-Helge Garli Hegvik
<> wrote:
> Can you show us some code and configurations?
> Nils-H
> On Tue, Jan 6, 2009 at 11:20 AM, Daoyue Ming <> wrote:
>> I have a problem to get the configuration inside portlet.xml in
>> action, what I do is inside the portlet.xml, I add some config like
>> the way struts2 did for defaultViewAction.  Then in my struts2 action,
>> I implements PortletContextAware, and try to get the config by using
>> portletContext.getInitParameter  method.  However what is returnted
>> from getInitParameter is the configuration in web.xml, not
>> portlet.xml.
>> Is there any valid way to get it?
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message