Netui defaultvalue

Hi folks,
I have a probelm in netui. I have one pageFlowController there I am populating
a UserInfo object.That object will have userId and password.I getting the information
in pageflowcontroller and setting it to session.Now if I want to get the value
in jsp using netui tag how to do that..
The sample code is
code in controller
===========
UserInfo uInfo=new UserInfo();
uInfo.setUserId("test");
uInfo.setPassword("test");
getSession().setAttribute("userInfo",uInfo);
Code in JSP
========
<netui:textBox dataSource="actionForm.userid} defaultValue={session.?}>
How to write the defaultvalue here.
Pls help me on that
Thanks
Sougata

Sougata--
There are two approaches that could work here.
1) bind directly to the object in the session with an expression like:
"{session.userInfo.userId}"
2) the second would pass the UserInfo object to the JSP as a page input. Using this method, the
UserInfo object will show up in the IDE on the JSP data palette, and you can bind to it using
{pageInput.userInfo.userId}.
Both of these approaches will yield the same result.
Note, the defaultValue on the textBox will only be used if the property referenced by the
dataSource's expression returns null.
Hope that helps...
Eddie
Sougata wrote:
Hi folks,
I have a probelm in netui. I have one pageFlowController there I am populating
a UserInfo object.That object will have userId and password.I getting the information
in pageflowcontroller and setting it to session.Now if I want to get the value
in jsp using netui tag how to do that..
The sample code is
code in controller
===========
UserInfo uInfo=new UserInfo();
uInfo.setUserId("test");
uInfo.setPassword("test");
getSession().setAttribute("userInfo",uInfo);
Code in JSP
========
<netui:textBox dataSource="actionForm.userid} defaultValue={session.?}>
How to write the defaultvalue here.
Pls help me on that
Thanks
Sougata

Similar Messages

  • How to keep the defaultValue in the netui:select tag at the beginning of the dropdown values?

    Hi,
    I am using <netui:select dataSource="{actionForm.xyz}" defaultValue="Any" optionsDataSource="{actionForm.someMap}"
    />
    Now I am getting the values from database to populate the dropdown using the optionsDataSource.
    As I am using the defaultValue, it is being added to the end of the dropdown and
    selected by default when I a mopening the page on browser.
    In my dropdown, the values are as follows:
    apple
    orange
    banana
    Any
    Now my requirement is, the defaultValue, Any, must be there at the top of the
    list instead at the bottom of thge dropdown values. i.e., In the above list, "Any"
    must be above apple option.
    How can I achieve this using netui:select tag?
    Thanks & Regards,
    Murthy

    Murthy,
    Unfortunately, though a very reasonable requirement, there is no option for
    placing the default item.
    - john
    "Murthy" <[email protected]> wrote in message
    news:[email protected]..
    >
    Hi,
    I am using <netui:select dataSource="{actionForm.xyz}" defaultValue="Any"optionsDataSource="{actionForm.someMap}"
    />
    Now I am getting the values from database to populate the dropdown usingthe optionsDataSource.
    As I am using the defaultValue, it is being added to the end of thedropdown and
    selected by default when I a mopening the page on browser.
    In my dropdown, the values are as follows:
    apple
    orange
    banana
    Any
    Now my requirement is, the defaultValue, Any, must be there at the top ofthe
    list instead at the bottom of thge dropdown values. i.e., In the abovelist, "Any"
    must be above apple option.
    How can I achieve this using netui:select tag?
    Thanks & Regards,
    Murthy

  • netui:checkBoxGroup defaultValue doesn't work

    Hi all,
    I tried with weblogic portal 10.0, to generate dynamically some checkboxes and precheck some of those. It looks quite simple in the tutorial:
    http://beehive.apache.org/docs/1.0.2/netui/apidocs/taglib/beehive.apache.org/netui/tags-html-1.0/checkBoxGroup.html
    <netui:checkBoxGroup
    dataSource="actionForm.preferredColors"
    optionsDataSource="${pageFlow.colors}"
    defaultValue="${pageFlow.defaultColor}" />
    where the optionsDataSource contains the name of the checkboxes and the defaultValue specifies which checkbox should be checked.
    However, all the generated checkbox are checked, the defaultValue is ignored, no matter which value is set for default value.
    Is it a bug of wls 10.0?
    Best regards,

    defaultValue attribute will not take effect AT ALL if the field is a select box, and allowNull is set to true.
    That is, when the form bean field is null, null is a valid value and thus defaultValue attribute is ignored.

  • Problem with netui:data repeater tag

    Hi,
    I have 10 checkboxes in a form. It is represented as array of boolean in the form.
    The form and the checkbox values are initialised in the JPF class. Using repeater
    tag to display the checkboxes.
    When the user clicks on first check box, all other check boxes should be selected.
    Need to do this with client side validation.
    Can someone tell me how to do this?

    Hi kunal,
    Thanks for your immediate response.
    But, if I use , I am getting an saying that the file does not exist.
    I have included your code, can you check it. Also, I just want the link to be displayed, not the values that I am getting through the netui-data:repeaterItem tag. Can you please help me.
    I am attaching my code here:
    <netui-data:repeater dataSource="{pageFlow.results2}">
    <netui-data:repeaterHeader></netui-data:repeaterHeader>
    <netui-data:repeaterItem >
    <netui:label value="{container.item.title}" defaultValue=" " ></netui:label>
    </netui-data:repeaterItem>
    <netui-data:repeaterItem>
    <netui:label value="{container.item.link}" defaultValue=" " ></netui:label>
    </netui-data:repeaterItem>
    <netui-data:repeaterItem>
    <netui:label value="{container.item.title}" defaultValue=" "></netui:label>
    </netui-data:repeaterItem>
    <netui-data:repeaterFooter></ol></netui-data:repeaterFooter>
    </netui-data:repeater>
    Thanks,
    Latha

  • Set selected in netui:select tag

    Hi, all
    I wonder how to set the selected item after come back from server. I have
    --- jsp
    <netui:select dataSource="{actionForm.personStr}" optionsDataSource="{actionForm.personOptionsHashMap}" defaultValue="-- select one --">
    --- server (.jpf)
    form.setPersonStr(form.getPersonStr());
    form.setPersonOptionsHashMap(hashMap);
    So when screen come back, it has selected duplicated at bottom of the selection. Is there a way like normal html select behavior ?
    Thanks inadvance for any inputs.

    Murthy,
    Unfortunately, though a very reasonable requirement, there is no option for
    placing the default item.
    - john
    "Murthy" <[email protected]> wrote in message
    news:[email protected]..
    >
    Hi,
    I am using <netui:select dataSource="{actionForm.xyz}" defaultValue="Any"optionsDataSource="{actionForm.someMap}"
    />
    Now I am getting the values from database to populate the dropdown usingthe optionsDataSource.
    As I am using the defaultValue, it is being added to the end of thedropdown and
    selected by default when I a mopening the page on browser.
    In my dropdown, the values are as follows:
    apple
    orange
    banana
    Any
    Now my requirement is, the defaultValue, Any, must be there at the top ofthe
    list instead at the bottom of thge dropdown values. i.e., In the abovelist, "Any"
    must be above apple option.
    How can I achieve this using netui:select tag?
    Thanks & Regards,
    Murthy

  • Netui-repeater tag

    Hi,
    I am trying to create links by using netui-data:repeater tag. But, I am getting all the links in the same line like:
    1 Link#1 2 Link#2 3 Link#3
    Can anyone let me know how can I get each value in a new line. I am adding my code here:
    netui-data:repeaterItem>
    <netui:label value="{container.item.articleID}" defaultValue=" " ></netui:label>
    <netui:anchor href="{container.item.link}" >
    <b><netui:label value="{container.item.title}" defaultValue="@nbsp;" ></b></netui:label></netui:anchor>
    </netui-data:repeaterItem>
    Thanks,
    Latha

    When you drag complex data onto jsp, Repeater wizard pops up, if you select "Next" instead of "Create", you will be prompted with different display options that you can select from like option "list" or "table" from the Data Format options.

  • Netui:select default value on top instead of bottom

    Is there anyway that I can change the netui:select tag to show the default value
    on the top of the list instead of the bottom?
    thanks
    kunal

    Kunal--
    If you are binding to a data set (a LinkedHashMap, for example), you can insert the default value
    into the data set in code in the JPF before binding to the select box, but it's not configurable
    when simply setting the defaultValue attribute.
    Apologies for the limitation.
    Eddie
    Kunal Mittal wrote:
    Is there anyway that I can change the netui:select tag to show the default value
    on the top of the list instead of the bottom?
    thanks
    kunal

  • Netui-data repeater tag question

    Hi,
    I am using netui-data:repeater tag to iterate through the results. I am adding a small code snippet:
    <netui-data:repeater dataSource="{pageFlow.results2}">
    <netui-data:repeaterItem>
    <netui:label value="{container.item.title}" defaultValue=" " ></netui:label>
    <netui:label value="{container.item.link}" defaultValue=" " ></netui:label>
    </netui-data:repeaterItem>
    Once, I get the link and the title, I want to construct a href, using the above values. Can anyone tell me how this can be done.
    Thanks,
    Latha

    Hi kunal,
    Thanks for your immediate response.
    But, if I use , I am getting an saying that the file does not exist.
    I have included your code, can you check it. Also, I just want the link to be displayed, not the values that I am getting through the netui-data:repeaterItem tag. Can you please help me.
    I am attaching my code here:
    <netui-data:repeater dataSource="{pageFlow.results2}">
    <netui-data:repeaterHeader></netui-data:repeaterHeader>
    <netui-data:repeaterItem >
    <netui:label value="{container.item.title}" defaultValue=" " ></netui:label>
    </netui-data:repeaterItem>
    <netui-data:repeaterItem>
    <netui:label value="{container.item.link}" defaultValue=" " ></netui:label>
    </netui-data:repeaterItem>
    <netui-data:repeaterItem>
    <netui:label value="{container.item.title}" defaultValue=" "></netui:label>
    </netui-data:repeaterItem>
    <netui-data:repeaterFooter></ol></netui-data:repeaterFooter>
    </netui-data:repeater>
    Thanks,
    Latha

  • Netui:select default value at the top

    I am using netui:select with following syntax:
    <netui:select defaultValue="--Select--" dataSource="{actionForm.contactType}"
    optionsDataSource="{pageFlow.contactTypes}" styleClass="app-commomForm"> </netui:select>
    The problem is "--Select--" is shown at the bottom of the drop down. What do I
    do to show at the top of the list?

    Maybe you can use the default value attribute, that way the user will always see the select selected...
    or maybe try using a string array and place select at the start of the array...

  • How can I use javascript to access netui data-repeater item?

    I have a 2-dim table of <netui: checkbox> using a <netui data-repeater> to interate over a contact email (column) and an event (rows).
              My problem is that I need to have a select all checkbox at the bottom of each column (per email) and be able to select all event for an email (when checked) and deselect all when the checkbox is unchecked.
              I can do it in java page flow but I can't have a page refresh.
              I want to do it on the page with javascript. The problem is that using
              document[getNetuiTagName("aform", this)][getNetuiTagName("email1", this)].checked
              with the "tagId" in each <netui> tag I can't access each iteration of the data repeater (I only get the last one).
              What I need is a reference to each repeater element. I do not know how many rows or columns I will have (based on the data).
              Is there any way to reference the obeject itself in javascript so I can loop through the items in the netui data-repeater?
              This is what is rendered in the html netui mapping:
              netui_names.con1="portlet_2_3wlw-checkbox_key:{actionForm.opts[4].cons[1].selContact}"
              I really want to be able to access this and loop through the arrays for opts (event) and cons(email)
              Here's the code:
              <netui:form action="submitEvents" tagId="eform" focus="">
              <table>
              <tr>
              <td>
              <table id="eTable" cellpadding="2" cellspacing="1" border="0">
              <tr bgcolor="#cccccc" class="BlackHeavy8">
              <!-- <td>Selected</td> -->
              <td colspan="2">Event</td>
              <netui-data:repeater dataSource="{pageFlow.contacts}" defaultText="No contacts configured.">
              <netui-data:repeaterHeader>
              </netui-data:repeaterHeader>
              <netui-data:repeaterItem>
              <netui-data:choiceMethod object="{pageFlow}" method="getAddHeader">
              <netui-data:methodParameter value="{container.item.contact_icon}" />
              </netui-data:choiceMethod>
              <netui-data:choice value="default">
              <td nowrap="true" bgcolor="#FFCCCC"><netui:image src="{container.item.contact_icon}"/>
              <netui:label value="{container.item.contact_value}" defaultValue=" "></netui:label>
              </td>
              </netui-data:choice>
              <netui-data:choice value="blue">
              <td nowrap="true" bgcolor="#D8EBFE"><netui:image src="{container.item.contact_icon}"/>
              <netui:label value="{container.item.contact_value}" defaultValue=" "></netui:label>
              </td>
              </netui-data:choice>
              <netui-data:choice value="green">
              <td nowrap="true" bgcolor="#CCFFCC"><netui:image src="{container.item.contact_icon}"/>
              <netui:label value="{container.item.contact_value}" defaultValue=" "></netui:label>
              </td>
              </netui-data:choice>
              <netui-data:choice value="yellow">
              <td nowrap="true" bgcolor="#FFFFCC"><netui:image src="{container.item.contact_icon}"/>
              <netui:label value="{container.item.contact_value}" defaultValue=" "></netui:label>
              </td>
              </netui-data:choice>
              </netui-data:repeaterItem>
              <netui-data:repeaterFooter></netui-data:repeaterFooter>
              </netui-data:repeater>
              </tr>
              <tr>
              <td colspan="7">
              <netui-data:repeater dataSource="{actionForm.opts}">
              <netui-data:repeaterHeader>
              </netui-data:repeaterHeader>
              <netui-data:repeaterItem>
              <netui-data:choiceMethod object="{pageFlow}" method="isEvenRow">
              <netui-data:methodParameter type="int" value="{container.index}" />
              </netui-data:choiceMethod>
              <netui-data:choice value="true">
              <tr class="BlackNorm8">
              <!-- <td align="center"> -->
              <!-- </td> -->
              <td colspan="2">
              <netui:label value="{container.item.eventName}" />
              <netui:hidden dataSource="{container.item.eventId}" />
              </td>
              <netui-data:repeater dataSource="{container.item.cons}">
              <netui-data:repeaterHeader>
              </netui-data:repeaterHeader>
              <netui-data:repeaterItem>
              <netui-data:choiceMethod object="{pageFlow}" method="getAddHeader">
              <netui-data:methodParameter value="{container.item.contact_icon}" />
              </netui-data:choiceMethod>
              <netui-data:choice value="default">
              <td align="center" bgcolor="#FFCCCC" >
              <netui:checkBox tagId="con1" dataSource="{container.item.selContact}" defaultValue="{container.item.selContact}" />
              <netui:hidden dataSource="{container.item.contact_id}" tagId="conid1" />
              </td>
              </netui-data:choice>
              <netui-data:choice value="blue">
              <td align="center" bgcolor="#D8EBFE" >
              <netui:checkBox id="con2" dataSource="{container.item.selContact}" defaultValue="{container.item.selContact}" />
              <netui:hidden dataSource="{container.item.contact_id}" tagId="conid2" />
              </td>
              </netui-data:choice>
              <netui-data:choice value="green">
              <td align="center" bgcolor="#CCFFCC" >
              <netui:checkBox tagId="con3" dataSource="{container.item.selContact}" defaultValue="{container.item.selContact}" />
              <netui:hidden dataSource="{container.item.contact_id}" tagId="conid3" />
              </td>
              </netui-data:choice>
              <netui-data:choice value="yellow">
              <td align="center" bgcolor="#FFFFCC" >
              <netui:checkBox tagId="con4" dataSource="{container.item.selContact}" defaultValue="{container.item.selContact}" />
              <netui:hidden dataSource="{container.item.contact_id}" tagId="conid4" />
              </td>
              </netui-data:choice>
              </netui-data:repeaterItem>
              <netui-data:repeaterFooter>
              </netui-data:repeaterFooter>
              </netui-data:repeater>
              </tr>
              </netui-data:choice>
              <netui-data:choice value="false">
              <tr class="BlackNorm8" bgcolor="#eeeeee">
              <!--<td align="center">-->
              <!--</td>-->
              <td colspan="2">
              <netui:label value="{container.item.eventName}" />
              <netui:hidden dataSource="{container.item.eventId}" />
              </td>
              <netui-data:repeater dataSource="{container.item.cons}">
              <netui-data:repeaterHeader>
              </netui-data:repeaterHeader>
              <netui-data:repeaterItem>
              <netui-data:choiceMethod object="{pageFlow}" method="getAddHeader">
              <netui-data:methodParameter value="{container.item.contact_icon}" />
              </netui-data:choiceMethod>
              <netui-data:choice value="default">
              <td align="center" bgcolor="#FFCCCC" >
              <netui:checkBox tagId="conalt1" dataSource="{container.item.selContact}" defaultValue="{container.item.selContact}" />
              <netui:hidden tagId="conidalt1" dataSource="{container.item.contact_id}" />
              </td>
              </netui-data:choice>
              <netui-data:choice value="blue">
              <td align="center" bgcolor="#D8EBFE" >
              <netui:checkBox tagId="conalt2" dataSource="{container.item.selContact}" defaultValue="{container.item.selContact}" />
              <netui:hidden tagId="conidalt2" dataSource="{container.item.contact_id}" />
              </td>
              </netui-data:choice>
              <netui-data:choice value="green">
              <td align="center" bgcolor="#CCFFCC" >
              <netui:checkBox tagId="conalt3" dataSource="{container.item.selContact}" defaultValue="{container.item.selContact}" />
              <netui:hidden tagId="conidalt3" dataSource="{container.item.contact_id}" />
              </td>
              </netui-data:choice>
              <netui-data:choice value="yellow">
              <td align="center" bgcolor="#FFFFCC" >
              <netui:checkBox tagId="conalt4" dataSource="{container.item.selContact}" defaultValue="{container.item.selContact}" />
              <netui:hidden tagId="conidalt4" dataSource="{container.item.contact_id}" />
              </td>
              </netui-data:choice>
              </netui-data:repeaterItem>
              <netui-data:repeaterFooter>
              </netui-data:repeaterFooter>
              </netui-data:repeater>
              </tr>
              </netui-data:choice>
              </netui-data:repeaterItem>
              <netui-data:repeaterFooter>
              </netui-data:repeaterFooter>
              </netui-data:repeater>
              Â </td>
              </tr>
              <!-- Select All Checkboxes -->
              <tr bgcolor="#cccccc" class="BlackHeavy8">
              <!-- <td>Selected</td> -->
              <td colspan="2">Select ALL</td>
              <netui-data:repeater dataSource="{pageFlow.contacts}" defaultText=" ">
              <netui-data:repeaterHeader>
              </netui-data:repeaterHeader>
              <netui-data:repeaterItem>
              <netui-data:choiceMethod object="{pageFlow}" method="getAddHeader">
              <netui-data:methodParameter value="{container.item.contact_icon}" />
              </netui-data:choiceMethod>
              <netui-data:choice value="default">
              <td align="center" nowrap="true" bgcolor="#FFCCCC">
              <netui:hidden dataSource="{container.item.contact_id}" tagId="chbox1" />
              <input type="checkbox" value="false"
              onclick="selectAllEvents('chbox1')">Select ALL
              </td>
              </netui-data:choice>
              <netui-data:choice value="blue">
              <td align="center" nowrap="true" bgcolor="#D8EBFE">
              <netui:hidden dataSource="{container.item.contact_id}" tagId="chbox2" />
              <input type="checkbox" value="false"
              onclick="selectAllEvents('chbox2')">Select All
              </td>
              </netui-data:choice>
              <netui-data:choice value="green">
              <td align="center" nowrap="true" bgcolor="#CCFFCC">
              <netui:hidden dataSource="{container.item.contact_id}" tagId="chbox3" />
              <input type="checkbox" value="false" onclick="selectAllEvents('chbox3')">Select All
              </td>
              </netui-data:choice>
              <netui-data:choice value="yellow">
              <td align="center" nowrap="true" bgcolor="#FFFFCC">
              <netui:hidden dataSource="{container.item.contact_id}" tagId="chbox4" />
              <input type="checkbox" value="false" onclick="selectAllEvents('chbox4')">Select All
              </td>
              </netui-data:choice>
              </netui-data:repeaterItem>
              <netui-data:repeaterFooter></netui-data:repeaterFooter>
              </netui-data:repeater>
              </tr>
              <!-- END Select ALL checkboxes -->
              </table>
              </td>
              <tr align="right">
              <td>
              <netui:button type="submit" value="Cancel" action="begin" styleClass="BlackNorm8"></netui:button>
              <netui:button value="Update" styleClass="BlackNorm8"/>
              </tr>
              </table>
              </netui:form>

    hi ,
    i dont know anything about delphi but from the experience from VB if the connection to oracle in delhpi doesnt recognise object type data field. Then try using OO4O drivers from oracle.if u use these drivers then u can access the sdo_geometry field !
    Hope this helps
    Vikesh

  • Netui tags and javascript

              Hello Gang, not sure if anyone has run into this issue, but here it goes.
              I got a netui:form with netui:checkboxes that I need to have a specific type of
              functionality.
              The first netui:checkbox when checked calls a javascript function that enables
              the remaining netui:checkboxes so that the user can check them.
              Except the first netui:checkbox, all other netui:checkboxes need to be disabled
              at run time and then enabled once the first check box is checked, below is the
              code I got thus far, can't get the diable/enable part to work for the netui tags.
              (Keep in mind that this works well with regular html checkbox tag and javascript)
              The following code wont generate javascript errors.
              It's not doing anything in terms of enabling/disabling the netui:checkboxes.
              <script language="javascript">
              function checkBoxDisable()
              document[getNetuiTagName("updateForm")][getNetuiTagName("tue")].disabled=true;
              document[getNetuiTagName("updateForm")][getNetuiTagName("wed")].disabled=true;
              document[getNetuiTagName("updateForm")][getNetuiTagName("thu")].disabled=true;
              document[getNetuiTagName("updateForm")][getNetuiTagName("fri")].disabled=true;
              function checkboxEnable()
              if (document[getNetuiTagName("updateForm")][getNetuiTagName("mon")].checked)
              document[getNetuiTagName("updateForm")][getNetuiTagName("tue")].disabled=false;
              document[getNetuiTagName("updateForm")][getNetuiTagName("wed")].disabled=false;
              document[getNetuiTagName("updateForm")][getNetuiTagName("thu")].disabled=false;
              document[getNetuiTagName("updateForm")][getNetuiTagName("fri")].disabled=false;
              else
              document[getNetuiTagName("updateForm")][getNetuiTagName("tue")].disabled="true";
              document[getNetuiTagName("updateForm")][getNetuiTagName("wed")].disabled="true";
              document[getNetuiTagName("updateForm")][getNetuiTagName("thu")].disabled="true";
              document[getNetuiTagName("updateForm")][getNetuiTagName("fri")].disabled="true";
              </script>
              <netui:form action="updateContact" tagId="updateForm">
              <netui:checkBox dataSource="{actionForm.accessDays}" defaultValue="{pageFlow.days[0]}"
              tagId="mon" onClick="checkboxEnable()"/>Monday
              <netui:checkBox dataSource="{actionForm.accessDays}" defaultValue="{pageFlow.days[1]}"
              tagId="tue"/>Tuesday
              <netui:checkBox dataSource="{actionForm.accessDays}" defaultValue="{pageFlow.days[2]}"
              tagId="wed"/>Wednesday
              <netui:checkBox dataSource="{actionForm.accessDays}" defaultValue="{pageFlow.days[3]}"
              tagId="thu"/>Thursday
              <netui:checkBox dataSource="{actionForm.accessDays}" defaultValue="{pageFlow.days[4]}"
              tagId="fri"/>Friday
              </netui:form>
              Any help on this will be appreciated ..
              

              Hello Gang, not sure if anyone has run into this issue, but here it goes.
              I got a netui:form with netui:checkboxes that I need to have a specific type of
              functionality.
              The first netui:checkbox when checked calls a javascript function that enables
              the remaining netui:checkboxes so that the user can check them.
              Except the first netui:checkbox, all other netui:checkboxes need to be disabled
              at run time and then enabled once the first check box is checked, below is the
              code I got thus far, can't get the diable/enable part to work for the netui tags.
              (Keep in mind that this works well with regular html checkbox tag and javascript)
              The following code wont generate javascript errors.
              It's not doing anything in terms of enabling/disabling the netui:checkboxes.
              <script language="javascript">
              function checkBoxDisable()
              document[getNetuiTagName("updateForm")][getNetuiTagName("tue")].disabled=true;
              document[getNetuiTagName("updateForm")][getNetuiTagName("wed")].disabled=true;
              document[getNetuiTagName("updateForm")][getNetuiTagName("thu")].disabled=true;
              document[getNetuiTagName("updateForm")][getNetuiTagName("fri")].disabled=true;
              function checkboxEnable()
              if (document[getNetuiTagName("updateForm")][getNetuiTagName("mon")].checked)
              document[getNetuiTagName("updateForm")][getNetuiTagName("tue")].disabled=false;
              document[getNetuiTagName("updateForm")][getNetuiTagName("wed")].disabled=false;
              document[getNetuiTagName("updateForm")][getNetuiTagName("thu")].disabled=false;
              document[getNetuiTagName("updateForm")][getNetuiTagName("fri")].disabled=false;
              else
              document[getNetuiTagName("updateForm")][getNetuiTagName("tue")].disabled="true";
              document[getNetuiTagName("updateForm")][getNetuiTagName("wed")].disabled="true";
              document[getNetuiTagName("updateForm")][getNetuiTagName("thu")].disabled="true";
              document[getNetuiTagName("updateForm")][getNetuiTagName("fri")].disabled="true";
              </script>
              <netui:form action="updateContact" tagId="updateForm">
              <netui:checkBox dataSource="{actionForm.accessDays}" defaultValue="{pageFlow.days[0]}"
              tagId="mon" onClick="checkboxEnable()"/>Monday
              <netui:checkBox dataSource="{actionForm.accessDays}" defaultValue="{pageFlow.days[1]}"
              tagId="tue"/>Tuesday
              <netui:checkBox dataSource="{actionForm.accessDays}" defaultValue="{pageFlow.days[2]}"
              tagId="wed"/>Wednesday
              <netui:checkBox dataSource="{actionForm.accessDays}" defaultValue="{pageFlow.days[3]}"
              tagId="thu"/>Thursday
              <netui:checkBox dataSource="{actionForm.accessDays}" defaultValue="{pageFlow.days[4]}"
              tagId="fri"/>Friday
              </netui:form>
              Any help on this will be appreciated ..
              

  • Netui:button  submit button tagID

    I use the repeater Wizard by dragging a member field in my .jpf
    controller file.
    public transient String[] mySPArr = {"A","B", ... "Z"};
    from the Date Palette onto the index.jsp.
    <netui-data:repeater dataSource="{pageFlow.myAlphaSArr}">
    <netui-data:repeaterHeader></netui-data:repeaterHeader>
    <netui-data:repeaterItem>
    <netui:label value="{container.item}" defaultValue=" "></netui:label>
    </netui-data:repeaterItem>
    <netui-data:repeaterFooter></netui-data:repeaterFooter>
    </netui-data:repeater>
    Editing out the Header and Footers and frame it with the netui:form
    <netui:form action="getPatientRECArrByAlpha">
    <netui-data:repeater dataSource="{pageFlow.myAlphaSArr}">
    <netui-data:repeaterItem>
    <netui:label value="{container.item}" defaultValue=" "></netui:label>
    </netui-data:repeaterItem>
    </netui-data:repeater>
    </netui:form>
    Next, I delete the netui:label and replace with a submit button
    <netui:form action="getPatientRECArrByAlpha">
    <netui-data:repeater dataSource="{pageFlow.myAlphaSArr}">
    <netui-data:repeaterItem>
    <netui:button type="submit" value="{container.item}"/>
    </netui-data:repeaterItem>
    </netui-data:repeater>
    </netui:form>
    This renders very nicely, what can be, a dynamic list of submit buttons labeled A thru Z. Now the only problem is I need it to render out to the browser in the form.
    <form ...>
    <input type=submit name="s1" value="A">
    <input type=submit name="s1" value="B">
    <input type=submit name="s1" value="C">
    <input type=submit name="s1" value="Z">
    </form>
    Where I have a form with multiple submit buttons 'submitting' one of the various parameter 's1' Strings (A thru Z) to my action method
    public Forward getPatientRECArrByAlpha(GetPatientRECArrByAlphaForm aForm)
    What I need is a bit better understanding of the tagId and how it will render out to
    browser the name attribute for the submit button.
    I tried;
    <netui:button type="submit" value="{container.item}" tagId="{actionForm.s1}"/>
    but I am missing something.

    Thomas,
         The tagId attribute is not bindable at runtime. You could write a
    little javascript that would set the value of a hidden parameter on the
    form with the value of the submit button.
         Here is one option. (I've attached the .jpf and 2 .jsps to show this
    working in a little application)
    <netui:html>
    <script language="javascript">
    function passValue(value)
    document.forms[getNetuiTagName("myForm")][getNetuiTagName("hidden")].value
    = value;
    obj =
    document.forms[getNetuiTagName("myForm")][getNetuiTagName("hidden")];
    return true;
    </script>
    <head>
    <title>Web Application Page</title>
    </head>
    <body>
    <p>
    <netui:form action="getPatientRECArrByAlpha" tagId="myForm">
    <netui:hidden dataSource="{actionForm.buttonValue}"
    tagId="hidden" dataInput="{actionForm.buttonValue}"/>
    <netui-data:repeater dataSource="{pageFlow.myAlphaStringArray}">
    <netui-data:repeaterItem>
    <netui:button type="submit" value="{container.item}"
    tagId="button" onClick="return passValue(this.value);"/>
    </netui-data:repeaterItem>
    </netui-data:repeater>
    </netui:form>
    </body>
    </netui:html>
         - john
    thomas wrote:
    I use the repeater Wizard by dragging a member field in my .jpf
    controller file.
    public transient String[] mySPArr = {"A","B", ... "Z"};
    from the Date Palette onto the index.jsp.
    <netui-data:repeater dataSource="{pageFlow.myAlphaSArr}">
    <netui-data:repeaterHeader></netui-data:repeaterHeader>
    <netui-data:repeaterItem>
    <netui:label value="{container.item}" defaultValue=" "></netui:label>
    </netui-data:repeaterItem>
    <netui-data:repeaterFooter></netui-data:repeaterFooter>
    </netui-data:repeater>
    Editing out the Header and Footers and frame it with the netui:form
    <netui:form action="getPatientRECArrByAlpha">
    <netui-data:repeater dataSource="{pageFlow.myAlphaSArr}">
    <netui-data:repeaterItem>
    <netui:label value="{container.item}" defaultValue=" "></netui:label>
    </netui-data:repeaterItem>
    </netui-data:repeater>
    </netui:form>
    Next, I delete the netui:label and replace with a submit button
    <netui:form action="getPatientRECArrByAlpha">
    <netui-data:repeater dataSource="{pageFlow.myAlphaSArr}">
    <netui-data:repeaterItem>
    <netui:button type="submit" value="{container.item}"/>
    </netui-data:repeaterItem>
    </netui-data:repeater>
    </netui:form>
    This renders very nicely, what can be, a dynamic list of submit buttons labeled A thru Z. Now the only problem is I need it to render out to the browser in the form.
    <form ...>
    <input type=submit name="s1" value="A">
    <input type=submit name="s1" value="B">
    <input type=submit name="s1" value="C">
    <input type=submit name="s1" value="Z">
    </form>
    Where I have a form with multiple submit buttons 'submitting' one of the various parameter 's1' Strings (A thru Z) to my action method
    public Forward getPatientRECArrByAlpha(GetPatientRECArrByAlphaForm aForm)
    What I need is a bit better understanding of the tagId and how it will render out to
    browser the name attribute for the submit button.
    I tried;
    <netui:button type="submit" value="{container.item}" tagId="{actionForm.s1}"/>
    but I am missing something.<%@ page language="java" contentType="text/html;charset=UTF-8"%>
    <%@ taglib uri="netui-tags-databinding.tld" prefix="netui-data"%>
    <%@ taglib uri="netui-tags-html.tld" prefix="netui"%>
    <%@ taglib uri="netui-tags-template.tld" prefix="netui-template"%>
    <netui-data:declarePageInput name="value" type="java.lang.String"/>
    <netui:html>
    <head>
    <title>
    Web Application Page
    </title>
    </head>
    <body>
    <p>
    <p>
    <p>
    <p>
    You pressed the button labeled "<netui:label value="{pageInput.value}"/>"
    </p>
    </body>
    </netui:html>
    [att1.html]
    import com.bea.wlw.netui.pageflow.FormData;
    import com.bea.wlw.netui.pageflow.PageFlowController;
    import com.bea.wlw.netui.pageflow.Forward;
    * This is the default controller for a blank web application.
    * @jpf:controller
    * @jpf:view-properties view-properties::
    * <!-- This data is auto-generated. Hand-editing this section is not recommended. -->
    * <view-properties>
    * <pageflow-object id="pageflow:/Controller.jpf"/>
    * <pageflow-object id="action:begin.do">
    * <property name="x" value="60"/>
    * <property name="y" value="80"/>
    * </pageflow-object>
    * <pageflow-object id="action:getPatientRECArrByAlpha.do#Controller.GetPatientRECArrByAlphaForm">
    * <property value="340" name="x"/>
    * <property value="80" name="y"/>
    * </pageflow-object>
    * <pageflow-object id="action-call:@page:index.jsp@#@action:getPatientRECArrByAlpha.do#Controller.GetPatientRECArrByAlphaForm@">
    * <property value="256,280,280,304" name="elbowsX"/>
    * <property value="73,73,73,73" name="elbowsY"/>
    * <property value="East_1" name="fromPort"/>
    * <property value="West_1" name="toPort"/>
    * </pageflow-object>
    * <pageflow-object id="page:index.jsp">
    * <property name="x" value="220"/>
    * <property name="y" value="80"/>
    * </pageflow-object>
    * <pageflow-object id="page:error.jsp">
    * <property name="x" value="220"/>
    * <property name="y" value="160"/>
    * </pageflow-object>
    * <pageflow-object id="forward:path#index#index.jsp#@action:begin.do@">
    * <property name="elbowsY" value="72,72,72,72"/>
    * <property name="elbowsX" value="96,140,140,184"/>
    * <property name="toPort" value="West_1"/>
    * <property name="fromPort" value="East_1"/>
    * <property name="label" value="index"/>
    * </pageflow-object>
    * <pageflow-object id="formbeanprop:Controller.GetPatientRECArrByAlphaForm#buttonValue#java.lang.String"/>
    * <pageflow-object id="formbean:Controller.GetPatientRECArrByAlphaForm"/>
    * <pageflow-object id="forward:path#success#showButtonValue.jsp#@action:getPatientRECArrByAlpha.do#Controller.GetPatientRECArrByAlphaForm@">
    * <property value="376,420,420,464" name="elbowsX"/>
    * <property value="73,73,53,53" name="elbowsY"/>
    * <property value="East_1" name="fromPort"/>
    * <property value="West_1" name="toPort"/>
    * <property value="success" name="label"/>
    * </pageflow-object>
    * <pageflow-object id="page:showButtonValue.jsp">
    * <property value="500" name="x"/>
    * <property value="60" name="y"/>
    * </pageflow-object>
    * </view-properties>
    public class Controller extends PageFlowController
    public transient String[] myAlphaStringArray = {"A", "B", "Z"};
    * @jpf:action
    * @jpf:forward name="index" path="index.jsp"
    protected Forward begin()
    return new Forward("index");
    * @jpf:action
    * @jpf:forward name="success" path="showButtonValue.jsp"
    protected Forward getPatientRECArrByAlpha(GetPatientRECArrByAlphaForm form)
    Forward f = new Forward("success");
    f.addPageInput("value", form.getButtonValue());
    return f;
    * FormData get and set methods may be overwritten by the Form Bean editor.
    public static class GetPatientRECArrByAlphaForm extends FormData
    private String buttonValue;
    public void setButtonValue(String buttonValue)
    this.buttonValue = buttonValue;
    public String getButtonValue()
    return this.buttonValue;

  • Netui defautvalue

    Hi folks,
    I have a probelm in netui. I have one pageFlowController there I am populating
    a UserInfo object.That object will have userId and password.I getting the information
    in pageflowcontroller and setting it to session.Now if I want to get the value
    in jsp using netui tag how to do that.. The sample code is code in controller
    =========== UserInfo uInfo=new UserInfo(); uInfo.setUserId("test"); uInfo.setPassword("test");
    getSession().setAttribute("userInfo",uInfo);
    Code in JSP ======== <netui:textBox dataSource="actionForm.userid} defaultValue={session.?}>
    How to write the defaultvalue here. Pls help me on that Thanks Sougata

    Dave -
    Have you tried the named-value de-referencing style in the JavaScript, e.g.
    document.whateverForm['{actionForm.somObject.otherObjects[3].description}']
    I don't know if it will work witha form object, but it's a thought.
    Greg
    Dave Muirhead wrote:
    The netui:textarea tag (and others like it) produce html element names (as in "<textarea
    name="...">) that can contain square brackets and curly braces. For example:
    {actionForm.someObject.otherObjects[3].description}
    Element names of this form cause problems with javascript expressions that attempt
    to refer to those elements. It is no longer possible to use an expression of the
    form:
    document.whateverForm.whateverTextArea
    when the value <someTextAreaElement> is something like the above because it resolves
    to:
    document.whateverForm.{actionForm.somObject.otherObjects[3].description}
    which is not legal Javascript syntax (due to curly braces)...
    Has anyone run into this? What's the work around? Thanks.
    Dave

  • CheckBoxGroup defaultValue doesn't work

    WLW 8.1 sp4
    Here's what I have setup:
    <netui:checkBoxGroup dataSource="{actionForm.fields}"
                         optionsDataSource="{pageFlow.possibleFields}"
                         defaultValue="{pageFlow.sessionForm.fields}"/>
    // debug - to make sure pageFlow.sessionForm.fields (type String[]) is properly populated by submits
    <netui-data:repeater dataSource="{pageFlow.sessionForm.fields}">
      <netui:label value="{container.item}" />,
    </netui-data:repeater>The check box group are rendered correctly.
    On submit, they populate the String[] field in session form correctly.
    However, the defaultValue array does not pre-select the check boxes on the browser.

    defaultValue attribute will not take effect AT ALL if the field is a select box, and allowNull is set to true.
    That is, when the form bean field is null, null is a valid value and thus defaultValue attribute is ignored.

  • Netui:repeater tags with ranges (aka prev/next)

    Is there some way to implement ranges using the <netui:data-repeater> tags? By
    ranges, I mean where you have 123 items in a list and you only display numbers
    1-50. Clicking NEXT would give you items 51-100. When you're there, clicking PREV
    would take you back to 1-50.
    Sample code would be nice. I think it could be done with the <netui:data-choiceMethod>
    tags, but what I am envisioning would be pretty ugly

    I am still stuck. I have the pager working fine. But, I have a checkbox that needs
    to be bound with the recordid. When the form is submitted after selecting records
    on multilple pages, I want to retrieve the recordids of records that were checked.
    How do I do that? A chckbox datasource can only be a one-value String property
    of a form. But, I need to save an array of ids that were checked. I am so lost.
    Please help.
    "bindu" <[email protected]> wrote:
    >
    So sorry Eddie,
    My bad I dint scroll down all the way. Thanks so much.
    Bindu
    Eddie O'Neil <[email protected]> wrote:
    John--
    Here's an example of implementing a paged repeater.
    Briefly, here's how it works:
    The entire data set (a Product[]) is stored in the JPF. When paging
    through this data set, a
    sliding window (also stored as a Product[]) is used to contain the "current"
    set of products to
    render in the page. The sliding window Product[] is of size PAGE_SIZE.
    When transitioning between
    pages, this window is recalculated for each page.
    Also calculated are the "currentPage", "lastPage", "prevPage", and
    "nextPage", which are used to
    render a pager like this:
    Page <currentPage> of <lastPage> <anchor to prevPage> <anchor to
    nextPage>
    The JPF and JSP are pretty well documented. To run the Page Flow,
    drop the JPF and JSP into a
    directory called "repeaterPaging" in an 8.1 SP2 webapp.
    There are lots of other ways this could be done (and certainly some
    that are more efficient :),
    but hopefully this helps get you started.
    Eddie
    Eddie O'Neil wrote:
    John--
    Yep, I did promise that, and nope, it hasn't been done yet. :)
    But, thanks for calling me on it.
    Will try to do that and distribute it to the list in the next fewdays.
    Eddie
    John H wrote:
    Eddie,
    You mentioned putting together an example of paging a repeater in
    this
    thread.
    Did you ever get a chance to put one together? Would really loveto
    see it if
    you did.
    Thanks,
    John
    Eddie O'Neil <[email protected]> wrote:
    Jan--
    We're talking about adding a pager to the repeater in a future
    release of Workshop, but I don't believe that it will appear inan
    8.1
    service pack.
    Additionally in 8.1, we are not exposing a NetUI tag SDK.
    That being said, it isn't that difficult ot build a pager from
    scratch with the <netu:anchor> / <netui:parameter> tags and a little
    code in a JPF.
    You'd want to have "prev" and "next" actions in the JPF to which
    anchors in the JSP are bound. Then, you can keep track of the "current"
    page in the URL and build the previous and next page indices fromthe
    value that is availble in the request. Finally, create an intermediate
    data structure that contains the data to display in the "current"page
    and bind the repeater to this data structure. You'd build the contents
    depending on whether the prev or next links were clicked. For example,
    if your data set has 100 items in it and you only want to displayitems
    20-29, you'd be on page 2 (depending on whether you start countingat
    0 :) and the intermediate list would contain exactly these items.
    Might sound complicated, but I think this would work out prettywell.
    Hope that helps...
    Eddie
    Jan Noppen wrote:
    Are there any plans to include the pager tag with the repeater
    in
    the
    next service packs or releases of WebLogic?
    If not, is there a way to build on the netui:taglibs to extend
    their
    functionality?
    I know the grid has paging functionality but it ties you to rowsetsfor input, whereas the repeater is much more flexible.
    <%@ page language="java" contentType="text/html;charset=UTF-8"%>
    <%@ taglib uri="netui-tags-databinding.tld" prefix="netui-data"%>
    <%@ taglib uri="netui-tags-html.tld" prefix="netui"%>
    <%@ taglib uri="netui-tags-template.tld" prefix="netui-template"%>
    <netui-data:declarePageInput name="displayProducts" type="repeaterPaging.Controller.Product[]"/>
    <netui:html>
    <head>
    <title>Paging with the Repeater</title>
    </head>
    <body>
    <p>
    <b>Paging with the Repeater</b>
    >>
    >> <!-- Pager Text -->
    <netui:label value="Page {request.currentPage} of {request.lastPage}"/>
    <!-- Previous page anchor -->
    <%if(request.getAttribute("prevPage") != null) { %>
    <netui:anchor action="page">
    Previous
    <netui:parameter name="_page" value="{request.prevPage}"/>
    </netui:anchor>
    <% } else {%>
    <!-- don't render the anchor when there is no previous
    page -->
    <netui:label value="Previous"/>
    <% } %>
    <!-- Next page anchor -->
    <% if(request.getAttribute("nextPage") != null) { %>
    <netui:anchor action="page">
    Next
    <netui:parameter name="_page" value="{request.nextPage}"/>
    </netui:anchor>
    <% } else {%>
    <!-- don't render the anchor when there is no next page
    -->
    <netui:label value="Next"/>
    <% } %>
    >> <!-- display the current window into the data set -->
    <netui-data:repeater dataSource="{pageInput.displayProducts}"
    ignoreNulls="true">
    <netui-data:repeaterHeader>
    <table class="tablebody" border="1" width="60%">
    <tr class="tablehead" valign="top">
    <th width="30%">Product ID</th>
    <th>Name</th>
    </tr>
    </netui-data:repeaterHeader>
    <netui-data:repeaterItem>
    <tr valign="top">
    <td align="center"><netui:label value="{container.item.id}"
    defaultValue=" "></netui:label></td>
    <td><netui:label value="{container.item.name}"
    defaultValue=" "></netui:label></td>
    </tr>
    </netui-data:repeaterItem>
    <netui-data:repeaterFooter></table></netui-data:repeaterFooter>
    </netui-data:repeater>
    </p>
    </body>
    </netui:html>
    package repeaterPaging;
    import com.bea.wlw.netui.pageflow.Forward;
    import com.bea.wlw.netui.pageflow.PageFlowController;
    * @jpf:controller
    * @jpf:forward name="success" path="index.jsp"
    * @jpf:forward name="page" path="page.do"
    * @jpf:view-properties view-properties::
    * <!-- This data is auto-generated. Hand-editing this section is not
    recommended. -->
    * <view-properties>
    * <pageflow-object id="pageflow:/repeaterPaging/Controller.jpf"/>
    * <pageflow-object id="action:begin.do">
    * <property value="80" name="x"/>
    * <property value="100" name="y"/>
    * </pageflow-object>
    * <pageflow-object id="action:page.do">
    * <property value="120" name="x"/>
    * <property value="100" name="y"/>
    * </pageflow-object>
    * <pageflow-object id="action-call:@page:index.jsp@#@action:page.do@">
    * <property value="204,180,180,156" name="elbowsX"/>
    * <property value="81,81,92,92" name="elbowsY"/>
    * <property value="West_0" name="fromPort"/>
    * <property value="East_1" name="toPort"/>
    * </pageflow-object>
    * <pageflow-object id="page:index.jsp">
    * <property value="240" name="x"/>
    * <property value="100" name="y"/>
    * </pageflow-object>
    * <pageflow-object id="forward:path#success#index.jsp"/>
    * <pageflow-object id="forward:path#page#page.do"/>
    * </view-properties>
    public class Controller extends PageFlowController
    // number of items to show on a single page
    private static final int PAGE_SIZE = 5;
    // URL parameter key for the value that will store the current page
    private static final String PAGE_PARAM_KEY = "_page";
    // Array to hold the entire data set
    private Product[] products = null;
    * Forward to the "page" action to set-up the first page of
    * data to display in index.jsp.
    * @jpf:action
    protected Forward begin()
    return new Forward("page");
    * Change the page of data that is displayed in index.jsp. This
    action
    * is used if paging to either the previous or to the next page.
    * @jpf:action
    protected Forward page()
    Forward f = new Forward("success");
    page(f);
    return f;
    * Implement data set paging. This method uses a simple _page paramater
    on the URL
    * to indicate the correct "page" to display when "Prev" or "Next"
    are clicked
    * in the JSP. The key principle at work here is a sliding window
    of size PAGE_SIZE
    * that is moved forward and backward through the complete dataset.
    This window
    * contains the set of items to render for a single "page" in the
    repeater. As
    * the current page changes, this window (an array of size PAGE_SIZE)
    is
    * reconstructed.
    * The pager consists of three parts:
    * - a simple "Page # of #" label
    * - a previous anchor that is enabled when there is a previouspage
    * - a next anchor that is enabled when there is a next page
    * To render a "page" of data, the _page parameter is convertedfrom
    a String
    * to an int. Using the page integer, the start and end of a window
    into the
    * complete data set is calculated. This windows slides back and
    forth along the
    * data set in PAGE_SIZE increments depending on the value of the
    current page.
    * In this case, with a PAGE_SIZE of 5 and data set size of 17,the
    possible windows
    * are:
    * products[0] -> products[4]
    * products[5] -> products[9]
    * products[10] -> products[14]
    * products[15] -> products[16]
    * Thus, the lastPage value is 4, which is calculated with the Math.ceil(...)
    * call below.
    * Given the start and end of this window, a temporary array ofsize
    PAGE_SIZE
    * is created to hold references to the items that should render
    from the complete
    * data set. This array is passed to the page as a JPF page input
    and is rendered
    * with the <netui-data:repeater/>.
    * Finally, four additional values are made available to the page
    in the request
    * and are used to render "Page # of #" and to provide parameters
    to anchors that
    * will display the previous and next pages:
    * - Page # of # -- the first # is "currentPage" and the second#
    is "lastPage"
    * - prevPage -- the int value of the previous page. If there is
    no previous page,
    * this value is null in the request
    * - nextPage -- the int value of the next page. If there is no
    next page, this value
    * is null in the request.
    * Notes:
    * - In order to have multiple repeaters on a page operating independently,
    * the "_page" parameter would need to change to include a namespace
    that
    * would be used when finding the current page for a data set.
    * - This JPF is implemented with a single "page" action that performs
    both
    * next and previous paging. This could also be implemented with
    "prevPage" and
    * "nextPage" actions that implement additional logic that runs
    on the previous
    * and next transitions.
    * - No real error checking is done to ensure that the PAGE_SIZE
    is greater than 0.
    * Handling errors:
    * - If parsing _page from the request fails to convert to an int,
    a NumberFormatException
    * is shown in the console and the first page will is used.
    * - If the current page value is greater than the number of pages,
    the last page will
    * be displayed.
    private void page(Forward f)
    assert PAGE_SIZE > 0;
    // calculate the last page
    int lastPage = (int)Math.ceil((float)products.length / (float)PAGE_SIZE);
    int currentPage = 1; // default page is page 1
    Product[] displayProducts = new Product[PAGE_SIZE];
    String currentPageStr = getRequest().getParameter(PAGE_PARAM_KEY);
    if(currentPageStr != null)
    try
    currentPage = Integer.parseInt(currentPageStr);
    catch(NumberFormatException nfe)
    nfe.printStackTrace();
    // continue with a current page of 1
    // ensure the current page is not greater than the number
    of pages
    if(currentPage > lastPage)
    currentPage = lastPage;
    // index into the entire data set at which the window starts
    // page indices are 1 based, adjust to be 0 based for accessing
    // the Product[]
    int start = (currentPage-1) * PAGE_SIZE;
    // index into the entire data set at which the window ends or
    the index
    // of the last item when rendering the last page
    int end = (currentPage != lastPage ? start + PAGE_SIZE : products.length);
    // fill-up the set of Product objects to render up to PAGE_SIZE
    // but don't run off the end of the products array
    for(int i = 0; i < PAGE_SIZE && (start+i < products.length);
    i++)
    displayProducts[i] = products[start + i];
    // set the previous page
    int prevPage = currentPage-1;
    if(prevPage > 0)
    getRequest().setAttribute("prevPage", new Integer(prevPage));
    // set the next page
    int nextPage = currentPage+1;
    if(nextPage <= lastPage)
    getRequest().setAttribute("nextPage", new Integer(nextPage));
    // set the current and last pages in the request in order to
    show "Page # of #"
    getRequest().setAttribute("currentPage", new Integer(currentPage));
    getRequest().setAttribute("lastPage", new Integer(lastPage));
    // set the current window in to the data set as a page input
    f.addPageInput("displayProducts", displayProducts);
    return;
    * Initialize a simple, sample data set that contains
    * 17 products with IDs running from 1-17 and text "Widget 1" to
    * "Widget 17".
    public void onCreate()
    int size = 17;
    products = new Product[size];
    for(int i = 1; i <= size; i++)
    products[i-1] = new Product("Widget " + i, i);
    * Simple JavaBean that contains production information.
    public static class Product
    implements java.io.Serializable
    private String name;
    private int id;
    public Product(String name, int id)
    this.name = name;
    this.id = id;
    public String getName() {return name;}
    public int getId() {return id;}

Maybe you are looking for