do i need to have for each element in my xhtml page ?

Splash Forums PrettyFaces Users do i need to have for each element in my xhtml page ?

Tagged: 

This topic contains 7 replies, has 3 voices, and was last updated by  Lincoln Baxter III 6 years, 6 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #17901

    vijayinder
    Participant

    If i am not adding any <query-param> in <url-mapping> non of my fields are updating in bean. is it necessary to have <query-param> for each input field i have in my xhtml ?


    Controller


    @ManagedBean

    @RequestScoped

    public class OrderController{

    @ManagedProperty(“#{orderBean}”)

    private OrderBean orderBean;


    Bean Class


    @ManagedBean

    @SessionScoped

    public class OrderBean{

    }

    #20840

    What do you mean with “not updating”? Could you please post more of your code and the relevant parts of the xhtml file?

    #20841

    vijayinder
    Participant

    below is the xhtml part. Values in the inputTexts are not updating in bean on form submit if i do add below query params in pretty-config.xml

    <query-param name=”id”>#{orderController.id}</query-param>

    vales of inputTexts inside ui:repeat are not updating in bean at all as i don’t know how to declare query param for dynamically created text fields.

    <form action=”SaveOrder”>

    <table border=”1″>

    <tr>

    <td align=”center”>

    <h:outputLabel for=”customerId” id=”labelCustomerId” value=”Customer Number” style=”font-size: 25px;”/>

    </td>

    <td align=”left”>

    <h:inputText class=”inlineTarget” id=”customerId” value=”#{orderBean.laundryOrder.customerId}” style=”font-size: 25px;” size=”10″/>

    <input type=”submit” value=”PRINT” style=”font-size: 25px;”/>

    </td>

    </tr>

    <tr><td colspan=”2″><h:outputText value=” ” escape=”false”/></td></tr>

    <tr>

    <td width=”55%” align=”justify”>

    <table width=”100%” border=”1″>

    <ui:repeat value=”#{orderBean.laundryOrder.washingServices}” var=”services”>

    <tr>

    <td width=”70%” align=”left”>

    <h:outputLabel value=”#{services.name}” style=”font-size: 25px;”/>

    </td>

    <td width=”30%” align=”center”>

    <h:inputText id=”quantity” class=”inlineTarget” value=”#{services.quantity}” style=”font-size: 25px;” size=”3″/>

    </td>

    </tr>

    <tr><td colspan=”2″><h:outputText value=” ” escape=”false”/></td></tr>

    </ui:repeat>

    </table>

    </td>

    <td width=”45%” align=”justify”>

    <span id=”inlineTargetKeypad”></span>

    </td>

    </tr>

    </table>

    <input type=”submit” value=”PRINT” style=”font-size: 25px;”/>

    </form>

    Appreciate your help.

    #20842

    vijayinder
    Participant

    Hi Christian – do you see any thing wrong here ?

    I am just wondering if <query-param> is required for all data elements in xhtml ?

    #20843

    vijayinder
    Participant

    sorry. the query param mentioned in above code snippet is wrong. here is the correct one:

    <query-param name=”customerId”>#{orderBean.laundryOrder.customerId}</query-param>

    #20844

    Look carefully at the HTTP post generated by the form. You will see that the name of your “customerId” is really “j_23sd:customerId”, because the form is prepending its id to the input field name.

    You need to use <form prependId="false">

    #20845

    @vijayinder: Why do you use a plain form instead of h:form? Could you explain a bit what you want to achieve with that?

    #20846

    PrettyFaces supports intercepting HTTP Post Parameters… but it is not a common use case, and is more a consequence of the technology than an intended feature. Yet, it should still work.

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

You must be logged in to reply to this topic.

Comments are closed.