[jboss-user] [JBoss Seam] - How to define default encoding ?

nevermoreagain do-not-reply at jboss.com
Wed May 30 00:35:32 EDT 2007


Hello =))
I wondering where can i define default page charset and encoding ?

I tryed to set PhaseListener


  | public class EncodingPhaseListener implements PhaseListener {
  | 	/**
  | 	 * 
  | 	 */
  | 	private static final long serialVersionUID = -   5249591857614335618L;
  | 	private static final String ENCODING = "UTF-8";
  | 	 
  | 	  public void afterPhase (final PhaseEvent event) {
  | 	  }
  | 	 
  | 	  public void beforePhase (final PhaseEvent event) {
  | 	    try {
  | 	      ((ServletRequest) FacesContext.getCurrentInstance ().getExternalContext ().getRequest ()).setCharacterEncoding (ENCODING);
  | 	      ((ServletResponse) FacesContext.getCurrentInstance ().getExternalContext ().getResponse ()).setCharacterEncoding (ENCODING);
  | 	    } catch (final UnsupportedEncodingException e) {
  | 	      e.printStackTrace();
  | 	    }
  | 	 
  | 	  }
  | 	 
  | 	  public PhaseId getPhaseId () {
  | 	    return PhaseId.ANY_PHASE;
  | 	  }
  | 	  
  | 	  
  | 	}
  | 
faces-config.xml

  | <lifecycle>
  | 		<phase-listener>
  | 			com.myproject.project.EncodingPhaseListener
  | 		</phase-listener>
  | </lifecycle>
  | 

but it's not working....

best regards

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4049579#4049579

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4049579



More information about the jboss-user mailing list