You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Luis Gervaso <lu...@gmail.com> on 2008/01/31 17:49:11 UTC

ServletActionRedirectResult issue

Hi,

When I try to configure un ServletActionRedirectResult i obtain

Caused by:

java.lang.NullPointerException
	at org.apache.struts2.dispatcher.mapper.DefaultActionMapper.getUriFromActionMapping(DefaultActionMapper.java:466)
	at org.apache.struts2.dispatcher.ServletActionRedirectResult.execute(ServletActionRedirectResult.java:184)
	at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:348)



using

@Result(name="success",value="findAllTables",params={"namespace","/tables","eid","${eid}","etid","${etid}"},type=
ServletActionRedirectResult.class)
public class CreateTableAction extends BaseAction {

    private Long eid;
    private Long etid;

+ getters / setters

BUT using

@Result(name="success",value="findAllTables",params={"namespace","/tables","eid","${eid}","etid7777WHATEVER","${etid}"},type=
ServletActionRedirectResult.class)

works fine

maybe a problem or bug in the implementation

Regards

-- 
-------------------------------------------
Luis Alberto Gervaso Martin
Java EE Architect & Instructor
C/ Cuenca 4A, 2ºB
Getafe (Madrid)
SPAIN
mobile: (+34) 627983344
luis.gervaso@gmail.com

Re: ServletActionRedirectResult issue

Posted by Dave Newton <ne...@yahoo.com>.
--- Luis Gervaso <lu...@gmail.com> wrote:
> If i put the name "etid" an exception is thrown
> 
> If i put a larger parameter "whateverparametername" or simply "_" as
> parameter name the redirect works fine, i know it's sounds weird

Oh, I'm sorry; I read it backwards (I thought the wrong parameter didn't work
:)

Dave


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


Re: ServletActionRedirectResult issue

Posted by Luis Gervaso <lu...@gmail.com>.
Thanks Dave for the reply,

If i put the name "etid" an exception is thrown

If i put a larger parameter "whateverparametername" or simply "_" as
parameter name the redirect works fine, i know it's sounds weird

I thought that it the bug could come if the params attribute was a hash but
looking at the implementation i saw that is a String[]
(i have not investigated deeply if behind there is a hashmap)

Here is the action code

@Result(name="success",value="/jsp/tables/findAllTablesRedirect.jsp", type=
ServletDispatcherResult.class) // this is the fix
/**
* not working annotation
*
*
@Result(name="success",value="findAllTables",params={"namespace","/tables","eid","${eid}","etid","${etid}"},type=
ServletActionRedirectResult.class) // this not work
*
@Result(name="success",value="findAllTables",params={"namespace","/tables","eid","${eid}","etid777","${etid}"},type=
ServletActionRedirectResult.class) // this works (i can't understand why)
**/
public class CreateTableAction extends BaseAction {

    private Long eid;
    private Long etid;

    @Override
    public String execute() throws Exception {
        Model.createTable(eid,etid);
        return SUCCESS;
    }

    public Long getEid() {
        return eid;
    }

    public void setEid(Long eid) {
        this.eid = eid;
    }

    public Long getEtid() {
        return etid;
    }

    public void setEtid(Long etid) {
        this.etid = etid;
    }

}







On Jan 31, 2008 6:30 PM, Dave Newton <ne...@yahoo.com> wrote:

> I'm not sure I understand; in your annotation example you deliberately
> provide a wrongly-named parameter, right? Why?
>
> Dave
>
> --- Luis Gervaso <lu...@gmail.com> wrote:
>
> > My workaround
> >
> > @Result(name="success",value="/jsp/tables/findAllTablesRedirect.jsp",
> type=
> > ServletDispatcherResult.class)
> >
> > /jsp/tables/findAllTablesRedirect.jsp:
> >
> > <%
> >
> response.sendRedirect
> ("/eventoos/tables/findAllTables.action?eid="+request.getParameter("eid")+"&etid="+request.getParameter("etid"));
> > %>
> >
> > regards
> >
> > On Jan 31, 2008 5:49 PM, Luis Gervaso <lu...@gmail.com> wrote:
> >
> > > Hi,
> > >
> > > When I try to configure un ServletActionRedirectResult i obtain
> > >
> > > Caused by:
> > >
> > > java.lang.NullPointerException
> > >     at
> >
>
> org.apache.struts2.dispatcher.mapper.DefaultActionMapper.getUriFromActionMapping
> (DefaultActionMapper.java:466)
> > >
> > >     at
> >
> org.apache.struts2.dispatcher.ServletActionRedirectResult.execute(
> ServletActionRedirectResult.java:184)
> > >     at
> >
> com.opensymphony.xwork2.DefaultActionInvocation.executeResult(
> DefaultActionInvocation.java:348)
> > >
> > >
> > >
> > > using
> > >
> > >
> > >
> >
>
> @Result(name="success",value="findAllTables",params={"namespace","/tables","eid","${eid}","etid","${etid}"},type=
> > > ServletActionRedirectResult.class)
> > > public class CreateTableAction extends BaseAction {
> > >
> > >     private Long eid;
> > >     private Long etid;
> > >
> > > + getters / setters
> > >
> > > BUT using
> > >
> > >
> > >
> >
>
> @Result(name="success",value="findAllTables",params={"namespace","/tables","eid","${eid}","etid7777WHATEVER","${etid}"},type=
> > > ServletActionRedirectResult.class)
> > >
> > > works fine
> > >
> > > maybe a problem or bug in the implementation
> > >
> > > Regards
> > >
> > > --
> > > -------------------------------------------
> > > Luis Alberto Gervaso Martin
> > > Java EE Architect & Instructor
> > > C/ Cuenca 4A, 2ºB
> > > Getafe (Madrid)
> > > SPAIN
> > > mobile: (+34) 627983344
> > > luis.gervaso@gmail.com
> >
> >
> >
> >
> > --
> > -------------------------------------------
> > Luis Alberto Gervaso Martin
> > Java EE Architect & Instructor
> > C/ Cuenca 4A, 2ºB
> > Getafe (Madrid)
> > SPAIN
> > mobile: (+34) 627983344
> > luis.gervaso@gmail.com
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
-------------------------------------------
Luis Alberto Gervaso Martin
Java EE Architect & Instructor
C/ Cuenca 4A, 2ºB
Getafe (Madrid)
SPAIN
mobile: (+34) 627983344
luis.gervaso@gmail.com

Re: ServletActionRedirectResult issue

Posted by Dave Newton <ne...@yahoo.com>.
I'm not sure I understand; in your annotation example you deliberately
provide a wrongly-named parameter, right? Why?

Dave

--- Luis Gervaso <lu...@gmail.com> wrote:

> My workaround
> 
> @Result(name="success",value="/jsp/tables/findAllTablesRedirect.jsp", type=
> ServletDispatcherResult.class)
> 
> /jsp/tables/findAllTablesRedirect.jsp:
> 
> <%
>
response.sendRedirect("/eventoos/tables/findAllTables.action?eid="+request.getParameter("eid")+"&etid="+request.getParameter("etid"));
> %>
> 
> regards
> 
> On Jan 31, 2008 5:49 PM, Luis Gervaso <lu...@gmail.com> wrote:
> 
> > Hi,
> >
> > When I try to configure un ServletActionRedirectResult i obtain
> >
> > Caused by:
> >
> > java.lang.NullPointerException
> > 	at
>
org.apache.struts2.dispatcher.mapper.DefaultActionMapper.getUriFromActionMapping(DefaultActionMapper.java:466)
> >
> > 	at
>
org.apache.struts2.dispatcher.ServletActionRedirectResult.execute(ServletActionRedirectResult.java:184)
> > 	at
>
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:348)
> >
> >
> >
> > using
> >
> >
> >
>
@Result(name="success",value="findAllTables",params={"namespace","/tables","eid","${eid}","etid","${etid}"},type=
> > ServletActionRedirectResult.class)
> > public class CreateTableAction extends BaseAction {
> >
> >     private Long eid;
> >     private Long etid;
> >
> > + getters / setters
> >
> > BUT using
> >
> >
> >
>
@Result(name="success",value="findAllTables",params={"namespace","/tables","eid","${eid}","etid7777WHATEVER","${etid}"},type=
> > ServletActionRedirectResult.class)
> >
> > works fine
> >
> > maybe a problem or bug in the implementation
> >
> > Regards
> >
> > --
> > -------------------------------------------
> > Luis Alberto Gervaso Martin
> > Java EE Architect & Instructor
> > C/ Cuenca 4A, 2ºB
> > Getafe (Madrid)
> > SPAIN
> > mobile: (+34) 627983344
> > luis.gervaso@gmail.com
> 
> 
> 
> 
> -- 
> -------------------------------------------
> Luis Alberto Gervaso Martin
> Java EE Architect & Instructor
> C/ Cuenca 4A, 2ºB
> Getafe (Madrid)
> SPAIN
> mobile: (+34) 627983344
> luis.gervaso@gmail.com
> 


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


Re: ServletActionRedirectResult issue

Posted by Luis Gervaso <lu...@gmail.com>.
My workaround

@Result(name="success",value="/jsp/tables/findAllTablesRedirect.jsp", type=
ServletDispatcherResult.class)

/jsp/tables/findAllTablesRedirect.jsp:

<% response.sendRedirect("/eventoos/tables/findAllTables.action?eid="+request.getParameter("eid")+"&etid="+request.getParameter("etid"));
%>

regards

On Jan 31, 2008 5:49 PM, Luis Gervaso <lu...@gmail.com> wrote:

> Hi,
>
> When I try to configure un ServletActionRedirectResult i obtain
>
> Caused by:
>
> java.lang.NullPointerException
> 	at org.apache.struts2.dispatcher.mapper.DefaultActionMapper.getUriFromActionMapping(DefaultActionMapper.java:466)
>
> 	at org.apache.struts2.dispatcher.ServletActionRedirectResult.execute(ServletActionRedirectResult.java:184)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:348)
>
>
>
> using
>
>
> @Result(name="success",value="findAllTables",params={"namespace","/tables","eid","${eid}","etid","${etid}"},type=
> ServletActionRedirectResult.class)
> public class CreateTableAction extends BaseAction {
>
>     private Long eid;
>     private Long etid;
>
> + getters / setters
>
> BUT using
>
>
> @Result(name="success",value="findAllTables",params={"namespace","/tables","eid","${eid}","etid7777WHATEVER","${etid}"},type=
> ServletActionRedirectResult.class)
>
> works fine
>
> maybe a problem or bug in the implementation
>
> Regards
>
> --
> -------------------------------------------
> Luis Alberto Gervaso Martin
> Java EE Architect & Instructor
> C/ Cuenca 4A, 2ºB
> Getafe (Madrid)
> SPAIN
> mobile: (+34) 627983344
> luis.gervaso@gmail.com




-- 
-------------------------------------------
Luis Alberto Gervaso Martin
Java EE Architect & Instructor
C/ Cuenca 4A, 2ºB
Getafe (Madrid)
SPAIN
mobile: (+34) 627983344
luis.gervaso@gmail.com