Disappearing netui-data tags (workshop applications)
hoping there are a couple WLS workshops users on this forum....
This is a rather WLS Workshop problem that I have posted on the BEA forums but haven't got a response there.
Basically, my netui-data tags aren't displaying pageFlow data (underlying rowset, string array objects) after being deployed on a test single-domain server. I am developing with v8.1 on Windows XP then building an EAR and deploying into a WLS instanse running v8.2 on Solaris.
Have both grid and repeater tags which according to the logs (DBControl information is successful) should get valid pageFlow objects as a dataSource. I can return pageFlow RowSet data to select tags (plain netui tags) without problem but anything that is netui-data never gets presented (except for the pager labels assigned to grids).
Maybe the error is due to deploying from v8.1 to v8.2 (fails as well with v8.3)?
The deployed EAR containing all of the necessary WLS netui jar files and tld packages.
Maybe the error is due to a config.xml miss?
appreciate the help / matthew
error was due to mismatch between versions on unix/windows machines. the application generated from v81 ought to be compatably on v82/v83 but for some reason the JDBC metadata has changed between releases. / matthew
Similar Messages
-
Netui-data:callMethod in Workshop 9.2b
Hi!
I try to convert my Workshop 8.1 application to Workshop 9.2b.
In my application there is an EJB-Project and a Web-Project.
In my JSPs, i used the following code, to call a Method of a SessionBean without implementing some Code in my PageFlow:
<!-- Control Declaration -->
<netui-data:declareControl type="EJBController.TextControl" controlId="textControl" />
<!-- Control Declaration -->
<netui-data:callControl controlId="textControl" method="getText" resultId="$$lngbez$InfotextDp$$" >
<netui-data:methodParameter value='$$lngbez$InfotextDp$$'/>
<netui-data:methodParameter value="{pageFlow.h}"/>
</netui-data:callControl>
In 9.2b, I think I should use the netui-data:callMethod.
But all the samples I found about netui-data:callMethod are using object="${pageFlow}".
How can I call Methods of other Java-Classes like a SessionBean-Control as shown in the code above?
What's the right way to provide the object-parameter?
Thanks,
JosefJosef,
In 8.1 you were declaring the attribute textControl in the JSP using the
declareControl tag.
Because of the changes to the Controls container, the declareControl tag is
no longer available in 9.2
There is a 8.1 compatibility declareControl tag but we do not recommend
running your application in compitibility mode unless absolutely necessary.
The recommended approach to accessing controls directly from a JSP is as
follows:
<%
ControlBean bean = Controls.instantiate(ControlBean.class, null,
ControlThreadContext.getContext(), null);
pageContext.setAttribute("customControlBean", bean);
%>
<netui-data:callMethod object="${pageScope.customControlBean}"
method="getData" resultId="myData"></netui-data:callMethod>
<netui:content value="${myData}" />
Hope this helps!
Scott L'Hommedieu
WLW CCE
<Josef Feiertag> wrote in message news:[email protected]..
Hi!
I try to convert my Workshop 8.1 application to Workshop 9.2b.
In my application there is an EJB-Project and a Web-Project.
In my JSPs, i used the following code, to call a Method of a SessionBean
without implementing some Code in my PageFlow:
<!-- Control Declaration -->
<netui-data:declareControl type="EJBController.TextControl"
controlId="textControl" />
<!-- Control Declaration -->
<netui-data:callControl controlId="textControl" method="getText"
resultId="$$lngbez$InfotextDp$$" >
<netui-data:methodParameter value='$$lngbez$InfotextDp$$'/>
<netui-data:methodParameter value="{pageFlow.h}"/>
</netui-data:callControl>
In 9.2b, I think I should use the netui-data:callMethod.
But all the samples I found about netui-data:callMethod are using
object="${pageFlow}".
How can I call Methods of other Java-Classes like a SessionBean-Control as
shown in the code above?
What's the right way to provide the object-parameter?
Thanks,
Josef -
How to Display string array in jsp page using netui-data:repeater tag ??
hi,
I am trying to display a string array in a table using the netui-data:repeater tag.
I have to use a page flow controller Array(1 Dimensional) to be displayed in the jsp.
Can any one tell me how to print the array in a table of 3rows & 5 columns.
Here is the code on which I am crrently working on.
<netui-data:repeater dataSource="{pageFlow.strWorkObject_Array}">
<netui-data:repeaterHeader>
<table cellpadding="4" border="1" class="tablebody">
</netui-data:repeaterHeader>
<netui-data:repeaterItem>
<tr>
<td><netui:label value="{container.item}" >
</netui:label></td>
<td><netui:label value="{container.item}">
</netui:label></td>
<td><netui:label value="{container.item}">
</netui:label></td>
</tr>
</netui-data:repeaterItem>
<netui-data:repeaterFooter>
</table>
</netui-data:repeaterFooter>
</netui-data:repeater>weblogic.developer.interest.workshop
Mansoor Naseem wrote:
I would like to know where the pageflow newsgroup is.
These are all the groups in weblogic.developer.interest:
weblogic.developer.interest.60beta.* (5 groups) weblogic.developer.interest.management
weblogic.developer.interest.61beta.* (2 groups) weblogic.developer.interest.misc
weblogic.developer.interest.clustering.* (1 group) weblogic.developer.interest.performance
weblogic.developer.interest.commerce weblogic.developer.interest.personalization
weblogic.developer.interest.ejb.* (3 groups) weblogic.developer.interest.portal
weblogic.developer.interest.environment weblogic.developer.interest.rmi-iiop
weblogic.developer.interest.jdbc weblogic.developer.interest.security
weblogic.developer.interest.jms weblogic.developer.interest.servlet
weblogic.developer.interest.jndi weblogic.developer.interest.tools
weblogic.developer.interest.jsp weblogic.developer.interest.weblogicenterprise
MN -
Display string array in a table using netui-data:repeater tags
hi,
I am trying to display a string array in a table using the netui-data:repeater tag.
I have to use a page flow controller Array(1 Dimensional) to be displayed in the jsp.
Can any one tell me how to print the array in a table of 3rows & 5 columns.
Here is the code on which I am crrently working on.
<netui-data:repeater dataSource="{pageFlow.strWorkObject_Array}">
<netui-data:repeaterHeader>
<table cellpadding="4" border="1" class="tablebody">
</netui-data:repeaterHeader>
<netui-data:repeaterItem>
<tr>
<td><netui:label value="{container.item}" >
</netui:label></td>
<td><netui:label value="{container.item}">
</netui:label></td>
<td><netui:label value="{container.item}">
</netui:label></td>
</tr>
</netui-data:repeaterItem>
<netui-data:repeaterFooter>
</table>
</netui-data:repeaterFooter>
</netui-data:repeater>weblogic.developer.interest.workshop
Mansoor Naseem wrote:
I would like to know where the pageflow newsgroup is.
These are all the groups in weblogic.developer.interest:
weblogic.developer.interest.60beta.* (5 groups) weblogic.developer.interest.management
weblogic.developer.interest.61beta.* (2 groups) weblogic.developer.interest.misc
weblogic.developer.interest.clustering.* (1 group) weblogic.developer.interest.performance
weblogic.developer.interest.commerce weblogic.developer.interest.personalization
weblogic.developer.interest.ejb.* (3 groups) weblogic.developer.interest.portal
weblogic.developer.interest.environment weblogic.developer.interest.rmi-iiop
weblogic.developer.interest.jdbc weblogic.developer.interest.security
weblogic.developer.interest.jms weblogic.developer.interest.servlet
weblogic.developer.interest.jndi weblogic.developer.interest.tools
weblogic.developer.interest.jsp weblogic.developer.interest.weblogicenterprise
MN -
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 -
Workshop 8.1 - netui-data:repeater and netui:checkBox
Hi everybody.
How can i use netui-data:repeater and netui:checkBox to build a group of checkboxes ? I need something like Struts "indexed and mapped properties" (http://struts.apache.org/struts-doc-1.1/faqs/indexedprops.html)
I've tried something like this
== FORM ==
public List getSearchResult() {
return searchResult;
public void setSearchResult(List searchResult) {
this.searchResult = searchResult;
}== JSP ==
<<netui-data:repeater dataSource="{actionForm.searchResult}">>
<<tr bgcolor="#ffffff" class="text8b">>
<<td>><<netui:checkBox dataSource="{container.item.selected}" />><</td>><</tr>>
<</netui-data:repeater>>
I can see the values inside this page but when i submit this form, my list is empty (null).
What is the right way of do it ?
Thanks in advance.Hi Daniel
There are 2 ways you can acheive this.
1) Using something called Pageflowscoped form for this. This will let you use arrays for checkbox group.
The main part will be that you need to define a member varaible of the form at the pageflow level there by the data will not be lost
2) Using Request scoped form like you have now but need to modify the getter method to populate the "searchResult" object.
public List getSearchResult() {
if( null == searchResult){
System.out.println(" Pouplate the searchResult here. ");
searchResult= new ArrayList();
//populate the default values.
return this.searchResult;
More info at:
http://e-docs.bea.com/workshop/docs81/doc/en/workshop/guide/netui/guide/conReqScopedVsPageScopedBean.html
I have a sample with pageflowscoped bean and requestscoped bean that I can send you if you provide your email address.
Unfortunately we cannot attach files in the newsgroup.
Thanks
Vimala -
netui-data:getData tag related query
Hi
I need to be able to compare the values returned by <netui-data:getData> tag against
another variable (which is also implemented as <netui-data:getData>) .
I have something as below :-
<netui-data:getData resultId="variableA" value="{container.item.value}"/>
<netui-data:getData resultId="variableB" value="{request.variableB}"/>
<logic:equal value="variableB" name="variableA" > A equals B
</logic:equal>
I am trying to the use the struts <logic:equal> tag but I am not sure as to how
to compare the two variables . I can easily compare variableA with a constant
like "apples" as mentioned below :-
<logic:equal value="apples" name="variableA" > A equals apples
</logic:equal>
But my requirements are I need to compare the two variables . How do I do that
using the NetUI tags or struts tags ??
Thanks
KarIt worked like a charm John !! Still the good old scriplets to the rescue . Looks
like when things get way too comlicated in the jsp pages , we can flip back to
sciplets .
- Kar
"John Rohrlich" <[email protected]> wrote:
Kar,
If using scriptlet is okay you could do something like this
<netui-data:getData resultId="foo1" value="{pageFlow.foo1}"/>
<netui-data:getData resultId="foo2" value="{pageFlow.foo2}"/>
<%
if (pageContext.getAttribute("foo1") ==
pageContext.getAttribute("foo2"))
%>
<netui:label value="foo1 == foo2"/>
<%
%>
- john
"kar piyush" <[email protected]> wrote in message
news:4086b0f6$[email protected]..
Hi
I need to be able to compare the values returned by <netui-data:getData>tag against
another variable (which is also implemented as <netui-data:getData>).
I have something as below :-
<netui-data:getData resultId="variableA" value="{container.item.value}"/>
<netui-data:getData resultId="variableB" value="{request.variableB}"/>
<logic:equal value="variableB" name="variableA" > A equals B
</logic:equal>
I am trying to the use the struts <logic:equal> tag but I am not sureas
to how
to compare the two variables . I can easily compare variableA witha
constant
like "apples" as mentioned below :-
<logic:equal value="apples" name="variableA" > A equals apples
</logic:equal>
But my requirements are I need to compare the two variables . How doI do
that
using the NetUI tags or struts tags ??
Thanks
Kar -
Hi,
I am using <netui-data:repeater> tag to display array of object.
This array has 20 elements and I am displaying only 5 elements at one time and
providing next and previous button to the user.
Can I specify the starting index and the end index in repeater tag so that I
display
the processing array object values in my repeater tag.Tim,
I had a similar issue and I could not find a way via the start index and end index
as you would expect.
However, what you can do is write a method in your JPF and access it via <netui-data:choiceMethod...>
tag.Disdavntage being the repeater tag would still loop through rthe entire set,
but would display only what you want.
<netui-data:repeaterItem>
<netui-data:choiceMethod object="{pageFlow}" method="isLineCounterMaxed">
<netui-data:methodParameter value="{container.index}"/>
<netui-data:methodParameter value="{pageContext.lastLineNumber}"/>
</netui-data:choiceMethod>
<netui-data:choice value="true">
........DIsplay Your Data Here.......
</netui-data:choice >
</netui-data:repeaterItem>
Thanks
Rishi
"Tim" <[email protected]> wrote:
>
Hi,
I am using <netui-data:repeater> tag to display array of object.
This array has 20 elements and I am displaying only 5 elements at one
time and
providing next and previous button to the user.
Can I specify the starting index and the end index in repeater tag so
that I
display
the processing array object values in my repeater tag. -
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,
LathaHi 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:data-CallMethod tag
I have a question regarding this tag...
<netui-data:callMethod
object="{pageFlow}"
method="hello"
resultId="helloMessage"
/>
How do I specify which pageFlow to call the method on?
Thanks
KunalHi,
As per my knowledge u cannot specify other page flow.Only the JPF by which it is called will be called.
thanks
prasanth -
Netui-data:repeater tag error
hi ,
While using the netui repeater tag and am getting this
ERROR [11:45:10] (Logger.java:190) - Caught exception when evaluating expression
"{container.item.id}" with available binding contexts [actionForm, pageFlow, gl
obalApp, request, session, appication, pageContext, bundle, container, url, page
Input]. Root cause: com.bea.wlw.netui.script.xscript.UnsupportedContextOperation
Exception: A java.util.List types can not be indexed with a String with value "id"
any ideas why ? also the same code works elsewherehi there,
Its been resolved now , was a code error , it was actually using the wrong object.
thanks anyways -
In the netui-grid tag, the grid accepts a rowset as an input dataset. If the data
in the database is large, then will using the netui-grid be a memory hog ? Or
is there a way to limit the number of rows retreived ? Or does the data-grid
pull the data as and when the next link is clicked in the table (loads the data
only when needed ?
Please let me know. Thank you in advance.
UdayUdayraj--
That's a good question.
As with many data sets, you'll want to make sure to row-limit what
comes back from the database. Whether returning RowSets or an array of
beans, large data sets will consume memory especially when running under
heavy load.
The NetUI grid tags do not use database cursors or paging to fetch
data on-demand through a RowSet. A RowSet is a disconnected ResultSet
and contains all of the data that was returned in the ResultSet from
which it was created. So, if the ResultSet returns with 10,000 rows,
the RowSet will contain those rows. The tags "page" through the data
by rendering only a sliding window of the entire RowSet.
If you'd like to row-limit a data set returned from the DB control,
set the "max-rows" attribute in the @jc:sql annotation for a method.
For more info, see the docs for this annotation:
http://edocs.bea.com/workshop/docs81/doc/en/workshop/javadoc-tag/jc/sql.html?skipReload=true
Hope that helps.
Eddie
Udayraj Nair wrote:
In the netui-grid tag, the grid accepts a rowset as an input dataset. If the data
in the database is large, then will using the netui-grid be a memory hog ? Or
is there a way to limit the number of rows retreived ? Or does the data-grid
pull the data as and when the next link is clicked in the table (loads the data
only when needed ?
Please let me know. Thank you in advance.
Uday -
Date formatting in Rowset and netui-data:basiccolumn
Hello,
I am using the netui-data:basiccolumn to display columns in a row of data. One
of the fields is a Timestamp from the DB. It is printed out in a less than ideal
format. I'd normally just use a SimpleDateFormat object to correct this, but
I don't seem to have that control with the basicColumn. Is there a better way
to format date objects once at the presentation layer? Or am I stuck either formatting
them via SQL or in place in the RowSet?
Thanks,
MorganMorgan,
Have you tried using the <netui:formatDate> Tag ?
More information is available at
http://e-docs.bea.com/workshop/docs81/doc/en/workshop/taglib/www.bea.com/workshop/netui-tags-html-1.0/formatDate.html
Regards,
Raj Alagumalai
Backline Workshop Support
"Morgan Hall" <[email protected]> wrote in message
news:[email protected]..
>
Hello,
I am using the netui-data:basiccolumn to display columns in a row of data.One
of the fields is a Timestamp from the DB. It is printed out in a lessthan ideal
format. I'd normally just use a SimpleDateFormat object to correct this,but
I don't seem to have that control with the basicColumn. Is there a betterway
to format date objects once at the presentation layer? Or am I stuckeither formatting
them via SQL or in place in the RowSet?
Thanks,
Morgan -
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 uglyI 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;} -
Write to java object using netui:select tag
Hello,
I am iterating through a hashmap of java objects using a netui-data:repeater.
<netui-data:repeater dataSource="{pageFlow.MyHashMap}">
<netui-data:repeaterItem>
<netui-data:repeater dataSource= "{container.item.HashMapOfEmbeddedObjects}">
<netui-data:repeaterItem>
<netui:select dataSource= "{container.item.type}" optionsDataSource= "{container.item.typeChoices}" /> </td>
<netui:select dataSource= "{container.item.default}"
optionsDataSource= "{container.item.defaultChoices}" /> </td>
</netui-data:repeaterItem>
</netui-data:repeater>
</netui-data:repeaterItem>
</netui-data:repeater>
The java object has a field "HashMapOfEmbeddedObjects" that is itself a hashmap of java objects. I want to be able to make a selection and have it be written to the
"type" and "default" fields of the embedded objects, but dataSource="{container.item.default}" does not save the value of the selection.
Is there anyway to use the netui:select tag to write to the field on a java object? Any help is greatly appreciated.I have done it in the past. The java object need not be actionForm. The following write-up I found in edocs will help you achieve this.
Page Flow-Scoped Form Beans
Page Flow-scoped Form Bean instances have the same life-cycle as the Controller file instance. They are created and destroyed when the Controller file instance is created and destroyed. This makes Page Flow-scoped Form Beans useful for storing data that has been accumulated across many different JSP pages.
To create a Page Flow-scoped Form Bean instance, construct a public member variable of the Form Bean in the Controller file.
public class myController extends PageFlowController
public MyFormBean pageFlowScopedBean = new MyFormBean();
Once you have created a Page Flow-scoped instance of a Form Bean, you can pass the instance to action methods by using the @action form="form_bean" annotation.
public class myController extends PageFlowController
public MyFormBean pageFlowScopedBean = new MyFormBean();
* @jpf:action form="pageFlowScopedBean"
* @jpf:forward name="success" path="displayData.jsp"
protected Forward submit( MyFormBean form )
return new Forward( "success" );
Each time the submit() method is invoked, it is passed the same instance of the Form Bean, namely, pageFlowScopedBean, the instance that was created when the Controller file instance was created.
For more info go to http://e-docs.bea.com/workshop/docs81/doc/en/workshop/guide/netui/guide/conReqScopedVsPageScopedBean.html
Good luck.
--SJ
Maybe you are looking for
-
POST is not working in IE11, GET works.
Hi, There is a problem while execution of POST function using XMLHttpRequest, the same code works fine in IE8, here is the code. if (window.XMLHttpRequest !== undefined) {// code for IE7+, Firefox, Chrome, Opera, Safari var httpOb=new XMLHttpRequest(
-
Release strategy for info records
Hi All, Can I have a release strategy procedure for Inforecords to create PO? Please suggest some answers My client want to configure info record release strategy. Thanks in Advance, GANESHA
-
Agregated value in original report in not same as the drill down report
Hello experts, I have a issue with the drill down reports. Agregated value in the main report is not equal to the agregarated value in the drill down report. In my report I have a sales for jan 2011,feb 2011 so on For jan 2011 it is some thing $56000
-
Hello Experts! I have just to configure SSO between PI to SRM and I want to know how to test it. Specify the part of PI Abap to J2ee SRM Rewards!!
-
Updated from xp to windows 7 and iTunes won't play music
I have recently updated my computer from windows XP to windows 7, and I backed everything up on a flashdrive. I reinstalled all of my documents from the flashdrive using Window's easy transfer. I then downloaded the new iTunes. After it was done tran