Pretty Urls turns ugly when i click commandbutton without immediate attribute.

Splash Forums PrettyFaces Users Pretty Urls turns ugly when i click commandbutton without immediate attribute.

This topic contains 6 replies, has 2 voices, and was last updated by  caglar 9 years, 7 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #18358


    Hello; first of all, i’m new to java and jsf. i’m using jsf 2.1.1, Prettyfaces 3.3.2 and Primefaces 3.0.M4.

    Here is the summary of my code:

    pretty-config.xml :

    <url-mapping id=”question”>

    <pattern value=”/question/#{question}” />

    <view-id value=”/faces/questions/question.xhtml” />


    summary of question.xhtml:


    <f:viewParam name=”question” value=”#{questionBean.selectedQuestion}”

    converter=”questionConverter” />


    <h:form id=”form”>

    <div id=”question”>



    <div id=”writeanswer”>

    <p:editor value=”#{questionBean.answer}” width=”920″ required=”true”


    validatorMessage=”fgfgf” immediate=”true”>

    <f:validateLength maximum=”6000″ />


    <p:commandButton value=”Send” action=”#{questionBean.sendAnswer}” update=”:form” immediate=”true” />


    Summary of questionBean:

    private EntityQuestion selectedQuestion;

    private String answer;

    public EntityQuestion getSelectedQuestion() { return selectedQuestion; }

    public void setSelectedQuestion(EntityQuestion newValue) { selectedQuestion = newValue; }

    public String getAnswer() { return answer; }

    public void setAnswer(String newValue) { answer = newValue; }

    public void sendAnswer() {




    public class QuestionConverter implements Converter {

    public static EntityQuestion question = new EntityQuestion();

    EntityManagerFactory emf = Persistence.createEntityManagerFactory(“ProjectPU”);

    public EntityQuestion getAsObject(FacesContext context, UIComponent component, String value) {

    EntityManager em = emf.createEntityManager();

    Query query = em.createQuery(“SELECT s FROM EntityQuestion s WHERE s.url = :questionUrl”).setParameter(“questionUrl”, value);

    question = (EntityQuestion) query.getSingleResult();

    return question;


    public String getAsString(FacesContext context, UIComponent component, Object value) {

    EntityQuestion s = (EntityQuestion) value;

    return s.getUrl();



    when i open a question page first time everything works well. but when i remove immediate=”true” attribute from commandbutton on question.xhtml and add ajax=”false”, url goes wrong like that: “ProjectName.Question@19c4e4f” when i click. and questionConverter does not work. when i use immediate=”true” attribute, setAnswer setter does not getting called (maybe another problem cause to this but i don’t know and i can’t find !). maybe removing immediate=”true” attribute could be a solution. please help me.


    Hmm, nothing comes to mind. It sounds like maybe PrimeFaces is not correctly encoding the URL. Could you post the app and include steps to reproduce the problem, or create a new small sample app with minimal dependencies?





    my codes are in, country.xhtml and files. i use Netbeans 7.0.1, Glassfish 3.1.1 and Mysql 5.5.14. i uploaded all external libraries, project and database. i hope you will import easily.


    Hmm. Thank you for uploading! But, I should have just asked you to write a separate app that reproduces the issue without dependencies, sorry. That’s what I need :)




    if you will run the app, i uploded all you need to hotfile. otherwise tomorrow i will write new app without using database and jpa. as i said, my issue is in, country.xhtml and you can see these files in


    Please do, thanks so much!



    sorry for the late response, i was busy. i created new question class with simple java class, everything works well but is not working with Entity objects. did anybody try clean urls with jpa like as this sample ?

Viewing 7 posts - 1 through 7 (of 7 total)

The forum ‘PrettyFaces Users’ is closed to new topics and replies.

Comments are closed.