You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Johannes Hiemer <jh...@web.de> on 2005/08/02 12:36:20 UTC

No redirection after successfull form submit

Hi all,
I have a small problem with my redirection after a successfull form submit. After the form submit the same page as before is returned, but the action is performed properly. That means, the data is inserted in the database, but the "success" is not thrown. Here is my code, I am not sure if it the problem is based in the source or else where. I am using MyFaces 1.09 with Tiles.

###### faces-navigation.xml #######
	<navigation-rule>
		<from-view-id>/sparepart.jspx</from-view-id>
		<navigation-case>
			<from-action>#{sparepartSpringBean.add}</from-action>
			<from-outcome>success</from-outcome>
			<to-view-id>/success.jspx</to-view-id>
		</navigation-case>
	</navigation-rule>

######  SparepartHandler.java ########
public String add(ActionEvent event) {
		log.info(event.getSource());
		if(getSparepartManager().getSparepartByNumber(sparepart.getSpnumber().toString()).isEmpty() == true) {
			log.info("Dataset already exists just updating it");
			getSparepartManager().saveSparepart(sparepart);			
		} else {
			log.info("Creating new Sparepart-Dataset");
			getSparepartManager().saveSparepart(sparepart);
		}
		resetSparepart();
		String message = Utils.getMessageResourceBundle(getBundle(), "internalSparepartSuccess", null, getLocale());
		facescontext.addMessage("globalMessage", new FacesMessage(FacesMessage.SEVERITY_INFO, message, message));
		return "success";
	}


Btw. as you can see I am trying to add a specified message to my success.jspx. Is this the right way to solve that, or do I need to change something?

Thanks a lot for your help!

Regards Johannes
_________________________________________________________________________
Mit der Gruppen-SMS von WEB.DE FreeMail können Sie eine SMS an alle 
Freunde gleichzeitig schicken: http://freemail.web.de/features/?mc=021179