POST requests don't work

Splash Forums Rewrite Users POST requests don't work


This topic contains 12 replies, has 2 voices, and was last updated by  Lincoln Baxter III 8 years, 5 months ago.

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
  • #24434


    Hi. I’ve been using PrettyFaces for a while. It’s really great.
    The only problem I have is that I can’t make POST requests to any of the pages that are rewritten by PrettyFaces.
    I would really appreciate your help, because it’s a show stopper.


    <url-mapping id="market-view-item">
      <pattern value="/market/#{viewItem.itemId}" />
      <view-id value="/market/view-item.xhtml" />



    I used 2.0.4.Final until today. I hoped that it will work by upgrading to 2.0.5, but nothing.

    web page form:

    <h:form prependId="false">
      <p:inputTextarea rows="3" style="width:450px; margin:5px 0;" autoResize="false"/>
      <h:commandButton action="#{test.doSomething}" class="pg-button" value="Add comment"/>				  </h:form>

    CDI bean:

    public class TestB {
        public void doSomething() {
    	System.out.println("I work.........");

    Any ideas why POST requests are not executed? Whatever I do, they just don’t happen. No error at all. Just nothing. When I press the submit (“Add comment”) button, Chrome makes a request (ajax / non-ajax (I tried both)), but method “doSomething” is not triggered.
    I tried withing bean “viewItem” also (the one specified in pretty config), but nothing. I tried in 100 ways…
    I have to mention that all pretty faces config mappings work perfectly on GET requests, just that I can’t post from them.


    Very interesting. I saw your post on stackoverflow before I saw this, sorry about that. We’ve mostly been on vacation.

    Is there anything else in your application? What other libraries are you using? Icefaces by any chance? Have you checked if this works in a simple example application without other code or dependencies? If so, then there may be something conflicting in your application that we’ll need to resolve.

    Does this form work if you access the page directly from its native JSF url? /market/view-item.xhtml

    Again, sorry for the slow response, and sorry you’ve been having trouble! We hate bugs so we’ll try to get this worked out ASAP, but I’ll be surprised if it’s something complicated because this is pretty basic functionality that we’ve tested well.




    Hi again!
    Well, I tried with @SessionScoped and it worked, as I specified on stackoverflow.
    The “problem” is that I can’t isolate the error in a new project.
    Moreover, as specfied on stack, @RequestScoped POST seems to work from the second try (first try does just refresh the page, the second does execute the method).
    What is your view on this? What else should I check?

    PS. I use Apache Tomee 1.5.2 web profile

    • This reply was modified 8 years, 5 months ago by  zmirc. Reason: Tomee

    What other libraries are you using in your application other than PrettyFaces?



    I have attached pom.xml, web.xml and pretty-config.xml
    It’s very strange, I know, but very annoying also. I had to use servlets on some pages, because I couldn’t POST.
    I’m really looking forward for a great idea.
    Thanks in advance.


    I’ve noticed a common issue here. It seems like several people are having trouble when using prime-faces –

    I am confident that we can fix this issue. I’ll be looking into it, but it would be very helpful if you could figure out how to reproduce it in a sample application.

    One thought that crosses my mind: when you tried to create the sample app the first time, did you include prime-faces? If not, that might explain why you could not reproduce the error. What happens when you include PrimeFaces?


    I’ve created a sample app using your provided configuration files. The only thing I had to change was your Filter declarations for “Security” and “LoginRedirect”, so I am guessing that something in these two filters is causing problems. I did not experience any issues when getting this to work: See attached application.



    Hi, Lincoln!
    First of all, thanks for helping. It is something strange, that’s why I couldn’t isolate the problem (to get it happen in another project), which is not executing the POST requests at first try, but from the second one.
    I have removed the filters without any difference. The same behavior.

    I’ve just had the idea of testing the project in other Tomee version than 1.5.2. Surprisingly, dev version 1.6.0 from 29.07.2013 seems to don’t have this problem. Why didn’t I think at this sooner? 🙁 I had to write separate Servlet components for my post functionalities. Aaaah!

    Well, this means that not PrettyFaces was problematic (Huraay!), but, probably, Apache MyFaces, CDI impl. or something else in Tomee.
    Uf…I’m so happy that it works now.

    Thanks again for trying to help.


    Great! I’m glad that you figured out a solution. Sorry for the trouble. I hate when things don’t go right, and I know it can be frustrating 🙂 Also, thanks for posting what you found out. You might want to report this to the TomEE dev team if you think the problem comes back!



    Don’t worry and thanks again.
    I have already posted this on Tomee’s forum, and it seems that a lot of code was rewritten (according to Romain MB), so maybe that’s why the bug was fixed:
    Best wishes!

    • This reply was modified 8 years, 5 months ago by  zmirc.


    It seems that it didn’t work in other versions of Tomee neither.
    The problem was having a <c:forEach> in that page (inside a custom component used in that page), even though the commandButton was not inside the loop. By switching to <ui:repeat>, the problem is gone in all versions of Tomee.

    It is probably a bug in MyFaces, because Glassfish (with Majorra) doesn’t have this problem. (tested)

    So that’s why I wasn’t able to isolate the bug when I tried, because I wasn’t adding a <c:forEach> in the page. Finally!



    Ha…even more interesting.
    If <h:form> is after <c:forEach>, the POST method is not triggered at first try. It works just from the second try. That’s the original problem.

    If <h:form> is before <c:forEach>, the Post method (action of the form) is executed properly from the first time/click.


    Oh wow, looks like you ran into LOTS of problems! I’m glad you got it figured, out, and thanks for posting the solutions here.

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

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

Comments are closed.