Hi
No it does not work as exception is thrown. I can't understand how it
doesn't work as I have followed the example from site.
Cheers
Amin
On 18 Dec 2008, at 19:26, "Musachy Barroso" <musa...@gmail.com> wrote:
Is it working even with the exception? This result is a little bit
different, as it take as parameters, not only its own parameters, but
parameters passed to the redirect, so OGNL will complain about it
because those fields are not defined in the result class.
musachy
On Thu, Dec 18, 2008 at 2:23 PM, Amin Mohammed-Coleman <ami...@gmail.com
> wrote:
Hi
Thanks for your response:
Please find below my CreateContactAction class:
@SuppressWarnings("serial")
@Namespace(value="/")
@Results({
@Result(name="success", value="viewContact", params=
{"actionName",
"viewContact","contactId","${contactId}", "contactType","$
{contactType}"},
type=ServletActionRedirectResult.class),
@Result(name="error", value="search.error",
type=TilesResult.class)
})
@Component
public class CreatePersonalContactAction extends ActionSupport {
private String contactId;
private String contactType;
private ContactApplicationService contactApplicationService;
private PersonalContact contact;
public String execute() throws Exception {
Contact contactCreated =
contactApplicationService.createContact(contact);
setContactType("personal");
setContactId(contactCreated.getId().toString());
return SUCCESS;
}
public String getContactId() {
return contactId;
}
public void setContactId(String contactId) {
this.contactId = contactId;
}
public String getContactType() {
return contactType;
}
public void setContactType(String contactType) {
this.contactType = contactType;
}
public ContactApplicationService
getContactApplicationService() {
return contactApplicationService;
}
public void
setContactApplicationService(ContactApplicationService
contactApplicationService) {
this.contactApplicationService =
contactApplicationService;
}
public PersonalContact getContact() {
return contact;
}
public void setContact(PersonalContact contact) {
this.contact = contact;
}
}
Thanks again for your help!
On 18 Dec 2008, at 05:44, Nils-Helge Garli Hegvik wrote:
OGNL tries all elements on the stack until it finds a match, so it
would probably try the result as well. Could you show the code of
your
source and destination actions?
Nils-H
On Thu, Dec 18, 2008 at 12:15 AM, Amin Mohammed-Coleman
<ami...@gmail.com> wrote:
Hi
The both actions have the relevant getters and setters. It seems
as
though
the actionName is being ignored and the action that the result
thinks
should
go to is ServletActionRedirectResult.
Cheers
On 17 Dec 2008, at 22:35, Nils-Helge Garli Hegvik wrote:
Does the action you're redirecting from (not to) have the relevant
getters?
Nils-H
On Wed, Dec 17, 2008 at 11:26 PM, Amin Mohammed-Coleman
<ami...@gmail.com> wrote:
Hi
The ServletActionRedirectResult doesn;t have a contactId setter
as this
is
Struts class. The ViewContact action has the relevant setters.
Cheers
On 17 Dec 2008, at 22:16, Oscar Alvarez wrote:
2008/12/17 Amin Mohammed-Coleman <ami...@gmail.com>
Hi
Sorry for sending this again, but I was wondering if someone
might be
able
to help?
Thanks
Begin forwarded message:
From: Amin Mohammed-Coleman <ami...@gmail.com>
Date: 24 November 2008 16:50:50 GMT
To: user-h...@struts-apache.org
Subject: Exception when using ServletActionRedirectResult with
@Result
Hi
I am trying to redirect the success of an action to another
action
using
the following:
@Results({
@Result(name="success", value="viewContact", params=
{"namespace",
"/", "actionName", "viewContact", "contactId", "${contactId}",
"contactType", "${contactType}"},
type=ServletActionRedirectResult.class),
@Result(name="error", value="search.error",
type=TilesResult.class)
})
However I am getting the following exception:
Caused by: ognl.NoSuchPropertyException:
org.
apache.
struts2.dispatcher.ServletActionRedirectResult.contactId
The class ServletActionRedirectResult has a contactId public
setter????
at
ognl.
ObjectPropertyAccessor.
setProperty(ObjectPropertyAccessor.java:132)
at
com.
opensymphony.
xwork2.
ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:
27)
at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
at ognl.ASTProperty.setValueBody(ASTProperty.java:101)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
at ognl.SimpleNode.setValue(SimpleNode.java:246)
at ognl.Ognl.setValue(Ognl.java:476)
at
com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:
197)
at
com.
opensymphony.
xwork2.ognl.OgnlUtil.internalSetProperty(OgnlUtil.java:393)
I have looked around and upgraded to Struts 2.1.2 and am still
getting
the
exception. Would it be possible if someone can advise me on
what I
am
doing
wrong.
Thanks
Amin
--
Thanks,
Oscar
---
---
---------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org
---
------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org
---
------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org
---
------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org
--
"Hey you! Would you help me to carry the stone?" Pink Floyd
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org