As soon as the user saves the data I want that the user should be transferred to another url and therefore I had written a action which extends SaveAction and implements IForwardAction but the problem is that I don't know how to get id of the saved data?
setResetAfter(false); // In this way the key will be refreshed from saved Entity to View
super.execute(); // Save, and after it you have the oid in View
id=(String)getView().getKeyValues().get("id"); // Now, id has value
}
Cheers
Javi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As soon as the user saves the data I want that the user should be transferred to another url and therefore I had written a action which extends SaveAction and implements IForwardAction but the problem is that I don't know how to get id of the saved data?
My Class has declared id as
@Id @Hidden @GeneratedValue(generator="system-uuid")
@GenericGenerator(name="system-uuid", strategy = "uuid")
private String id;
Action Code
--------------------
public class SaveAction extends org.openxava.actions.SaveAction implements IForwardAction {
private String url;
@Override
public void execute() throws Exception {
// TODO Auto-generated method stub
id=(String)getView().getKeyValues().get("id");
super.execute();
}
public String getForwardURI() {
// TODO Auto-generated method stub
return "/xava/custom/forward.jsp?url="+url;
}
public boolean inNewWindow() {
// TODO Auto-generated method stub
return false;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}
Thanks in advance
CSJakharia
Hi CSJakharia,
do it in this way:
public void execute() throws Exception {
setResetAfter(false); // In this way the key will be refreshed from saved Entity to View
super.execute(); // Save, and after it you have the oid in View
id=(String)getView().getKeyValues().get("id"); // Now, id has value
}
Cheers
Javi
Thanks that works
CSJakharia