Re: How can handle URL ?

Splash Forums PrettyFaces Users How can handle URL ? Re: How can handle URL ?

#21366

thanhtung90
Participant

Hi Christian, I created new project for PrettyFaces and see seem problem in here.

These are codes in new project:

static String def;// i tried save value of category with static but fail.
public void setCategory(String category) {
System.out.println("ABC"+category);
// if(this.category.equals("") || this.category == null)
this.category = category;
def = category;
}

public DanhMucController() { // this constructor, i fear it call multi time but just called 1 TIME by Spring,
System.out.println("CALL me");
}

public String navigator() {
ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
Map<String, String> map = externalContext.getRequestParameterMap();
String res = externalContext.getRequestServletPath();
String contextPath = externalContext.getRequestContextPath();
System.out.println("Param: " + def + " || category: " + category + " || contextPath: " + contextPath + " || res: " + res);
return "hehe";// this code no need care.
}

and this is result i received when access from url http://localhost:8084/WebApplication2/test/:

Param: null || category: null || contextPath: /WebApplication2 || res: /faces
ABCtest
ABCtest

Fine, traced “test” but AFTER navigator call. So always NULL with param or even category variable.

I think this is problem.