Re: “Invalid number of parameters supplied for pattern” error

Splash Forums PrettyFaces Users "Invalid number of parameters supplied for pattern" error Re: “Invalid number of parameters supplied for pattern” error

#20347

balteo
Participant

Thanks Christian!

It almost works. The only problem I have now is as follows: when I run this: “http://localhost:8080/” (notice the “/lang/fr/” is not specified) I get the same error as before.

Any idea?

Here is my bean:

*************************

package com.jeanbaptistemartin.view;

import com.ocpsoft.pretty.faces.annotation.URLAction;

import com.ocpsoft.pretty.faces.annotation.URLMapping;

import java.util.Locale;

import javax.faces.component.UIViewRoot;

import javax.faces.context.FacesContext;

import org.apache.log4j.Logger;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.context.annotation.Scope;

import org.springframework.stereotype.Component;

/**

*

* @author julien

*/

@Component(“accueilView”)

@Scope(“request”)

@URLMapping(id = “rootAction”, pattern = “/lang/#{accueilView.language}/”, viewId = “/accueil.jsf”)

public class AccueilView {

private static transient Logger log = Logger.getLogger(“com.jeanbaptistemartin.view”);

private SuggestionOeuvreView suggestionOeuvreView;

private String language;

public AccueilView() {

log.info(“AccueilView()”);

}

public String suggererSculpture() {

log.debug(“suggererSculpture”);

getSuggestionOeuvreView().setSculptureSuggeree(getSuggestionOeuvreView().suggererSculpture());

return null;

}

@URLAction

public void changeLocale() {

log.info(“changeLocale”);

UIViewRoot view = FacesContext.getCurrentInstance().getViewRoot();//todo locale en dur içi

if (“fr”.equals(this.language)) {

view.setLocale(Locale.FRENCH);

} else if (“en”.equals(this.language)) {

view.setLocale(Locale.ENGLISH);

}

getSuggestionOeuvreView().setSculptureSuggeree(getSuggestionOeuvreView().suggererSculpture());//refactor

}

@Autowired

@Scope

public void setSuggestionOeuvreView(SuggestionOeuvreView suggestionOeuvreView) {

log.debug(“setSuggestionOeuvreView”);

this.suggestionOeuvreView = suggestionOeuvreView;

}

public SuggestionOeuvreView getSuggestionOeuvreView() {

log.debug(“getSuggestionOeuvreView”);

return this.suggestionOeuvreView;

}

/**

* @return the language

*/

public String getLanguage() {

return language;

}

/**

* @param language the language to set

*/

public void setLanguage(String language) {

this.language = language;

}

}

*************************