Netui:select tag
Hi,
I have a netui:select tag. When the user selects an option, I want it to execute
the form's action (instead of having users to click a submit button).
How do you do this?
Thanks
Laxman
Hi,
I think you can add a submit() javascript to the onselect action of the
select tag. When the user selects a value the form will be subitted that
means the form's action will be executed.
BR,
don
Vangarapu Laxman wrote:
Hi,
I have a netui:select tag. When the user selects an option, I want it to execute
the form's action (instead of having users to click a submit button).
How do you do this?
Thanks
Laxman
Similar Messages
-
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 -
Form bean with int property and netui:select tag
Hi,
I've recently started using WebLogic 8.1 for a client project. There's
been a bit of a learning curve, but I've been able to find most of my
answers in the docs or on the dev2dev site. This one, though, I've been
unable to manage.
I have a database table, call it foo. In it I have columns for id
(numeric) and name (string). I created a database control to read that
data:
select id, name
from foo
I then want to use this data to populate a select list in a form, which
is going to be used to submit new records for another table. For the data:
id name
1 Foo
2 Bar
3 Bletch
I want to generate a select list (this is the output HTML, not the netui
tags):
<select name="foo">
<option value="1">Foo</option>
<option value="2">Bar</option>
<option value="3">Bletch</option>
</select>
My first question is what the best way to do this is. I was able to get
this working by creating a database control, which returns an array of a
custom Foo class. I then pass that array into a utility method which
converts it into a Map, and pass that map to the netui:select tag in the
optionDataSource attribute. This works, but it seems rather roundabout,
so I'm wondering if there's a better way to do it, without needing the
conversion utility method in the middle. I tried playing around with
the control, I tried using different netui tags (I thought I could do it
with a repeater and netui:selectOption tags, but that didn't work), and
nothing else worked.
The second problem arose when I was tying the result to a Form Bean. I
created a bean with all the data that I was reading from the form, and
at first, I just made everything in the form bean be a String. For this
select, though, the values are ids, so I thought I'd just make them be
ints in the form bean instead. However, when I did that, WL decided
that it wanted to add in a default option with a value of 0:
<select name="foo">
<option value="1">Foo</option>
<option value="2">Bar</option>
<option value="3">Bletch</option>
<option value="0" selected>0</option>
</select>
I've tried to find a way to get rid of that 0, and I can't. Is there a
way to prevent it from sticking in a default value like that? Or do I
have to just leave it as a String in the form bean to get it to work the
way I want?
Thanks in advance for your help.
Joe Robins Tel: 212-918-5057
Thaumaturgix, Inc. Fax: 212-918-5001
19 W. 44th St., Suite 810 Email: [email protected]
New York, NY 10036 http://www.tgix.com
thau'ma-tur-gy, n. the working of miracles.wrt your 2nd problem, in the jpf, for the form bean, are you declaring your id
like this:
private int id;
if so, try declaring it w/ a valid value, like:
private int id = 1;
-tanya
Joe Robins <[email protected]> wrote:
Hi,
I've recently started using WebLogic 8.1 for a client project. There's
been a bit of a learning curve, but I've been able to find most of my
answers in the docs or on the dev2dev site. This one, though, I've been
unable to manage.
I have a database table, call it foo. In it I have columns for id
(numeric) and name (string). I created a database control to read that
data:
select id, name
from foo
I then want to use this data to populate a select list in a form, which
is going to be used to submit new records for another table. For the
data:
id name
1 Foo
2 Bar
3 Bletch
I want to generate a select list (this is the output HTML, not the netui
tags):
<select name="foo">
<option value="1">Foo</option>
<option value="2">Bar</option>
<option value="3">Bletch</option>
</select>
My first question is what the best way to do this is. I was able to
get
this working by creating a database control, which returns an array of
a
custom Foo class. I then pass that array into a utility method which
converts it into a Map, and pass that map to the netui:select tag in
the
optionDataSource attribute. This works, but it seems rather roundabout,
so I'm wondering if there's a better way to do it, without needing the
conversion utility method in the middle. I tried playing around with
the control, I tried using different netui tags (I thought I could do
it
with a repeater and netui:selectOption tags, but that didn't work), and
nothing else worked.
The second problem arose when I was tying the result to a Form Bean.
I
created a bean with all the data that I was reading from the form, and
at first, I just made everything in the form bean be a String. For this
select, though, the values are ids, so I thought I'd just make them be
ints in the form bean instead. However, when I did that, WL decided
that it wanted to add in a default option with a value of 0:
<select name="foo">
<option value="1">Foo</option>
<option value="2">Bar</option>
<option value="3">Bletch</option>
<option value="0" selected>0</option>
</select>
I've tried to find a way to get rid of that 0, and I can't. Is there
a
way to prevent it from sticking in a default value like that? Or do
I
have to just leave it as a String in the form bean to get it to work
the
way I want?
Thanks in advance for your help.
Joe Robins Tel: 212-918-5057
Thaumaturgix, Inc. Fax: 212-918-5001
19 W. 44th St., Suite 810 Email: [email protected]
New York, NY 10036 http://www.tgix.com
thau'ma-tur-gy, n. the working of miracles. -
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,
MurthyMurthy,
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 -
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 -
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
kunalKunal--
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 -
Load contents into one "netui:select" on click of another.
Hi! I am a fresher to Weblogic Workshop and Portal. I want to know how to capture the onSelect or onChange event in a <netui:select> tag and call a pageflow action on the occurence of this event.
I remember this keyboard menu. Didn't I give you the CSS for this? I'm pretty sure I did. Because I still have it in my notes.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Horizontal Menu</title>
<!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<style>
/* BEGIN Horizontal Navbar */
nav {
margin: 0 auto;
padding: 0;
width: 900px; /**adjust width as required**/
font-family: "Gill Sans", "Gill Sans MT", "Myriad Pro", "DejaVu Sans Condensed", Helvetica, Arial, sans-serif;
overflow: hidden; /**float containment**/
border: 1px dotted red; /**for demo purposes, you may delete this border**/
nav ul {
list-style: none;
padding: 0;
margin: 0;
width: auto;
/**list styles**/
nav li {
display: block;
float: left;
width: auto;
line-height: 1em;
margin: 0;
padding: 0;
text-align: center;
font-size: 15px;
text-shadow: 1px 1px 1px #000;
/**link styles**/
nav li a {
display: block;
padding: 0.5em;
border: 2px outset #999;
color: #FFF;
font-weight: bold;
text-decoration: none;
background: #CCC;
/**mouseover styles**/
nav li a:hover,
nav li a:active,
nav li a:focus {
border: 2px inset;
background: #00CCCC; }
/* END Horizontal Navbar */
</style>
</head>
<body>
<nav>
nav container
<ul>
<li><a href="#">Menu Item 1</a></li>
<li><a href="#">Menu Item 2</a></li>
<li><a href="#">Menu Item 3</a></li>
<li><a href="#">Menu Item 4</a></li>
</ul>
<!--end nav--></nav>
</body>
</html>
Nancy O. -
Netui:select seems to be broken in Portal 9.2
Hi
I have problems with the tag and I slowly think it might be a bug in the tag. The optionsDataSource attribute seems not to work anymore. It only puts the actual text '{pageFlow._options}' in the dropdown box. I tried to use it with the pageFlow and actionForm option but with the same result. I hope there is something I do wrong ;) Any help is very much appreciated
on JSP page
<netui:select dataSource="{actionForm.selections}" optionsDataSource="{pageFlow._options}"
in JPFController
public String[] _options = {"red", "green", "blue", "orange", "pink", "aqua", "black", "brown", "tan"};
with setters and getters
in formbean
public static class SubmitForm extends FormData
private String[] selections;
public void setSelections(String[] selections)
this.selections = selections;
public String[] getSelections()
return this.selections;
}That did the trick ;\
optionsDataSource="${pageFlow.selectOptions} -
Select tag not working in portal
hi all,
i have a dynamic select (drop down) in my jsp page flow portlet.when i run the portlet the page is rendered perfectly,but when i run it with the portal ,it is not rendering the jsp page.what could be the problem...
code of dynamic select is as below.
<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
<%@taglib uri="http://beehive.apache.org/netui/tags-databinding-1.0" prefix="netui-data"%>
<%@taglib uri="http://beehive.apache.org/netui/tags-template-1.0" prefix="netui-template"%>
<netui:html>
<head>
<netui:base/>
</head>
<netui:body>
<netui:form action="SuperpoolAction">
<td width ="25%"><netui:label value="Superpool"/></td>
<td>
<netui:select dataSource="actionForm.superpool" tagId="superpool" optionsDataSource="${requestScope.superPoolMap}" >
</netui:select>
</td>
</netui:form>
</netui:body>
</netui:html>
help provided will be really useful.Hi Barjinder Singh,
In development you can't find the records for the table.
In testing system only you can test even the program(report).
If it is the DEV system you can't get the data.
Go and see into the table wether it has records or not(in DEV system).
It doesn't has the records in DEV system.
Regards,
Balakrishna.N -
Netui:fileUpload tag and unicode
when i attach files using netui:fileUpload tag, korean file names are broken.
charset of my jsp page is UTF-8.
<%@ page language="java" contentType="text/html;charset=UTF-8"%>
chinese and japanese can be used, so default charset can not be changed to EUC-KR.
but other data of netui:textBox or netui:select are normal.
and when using normal html tag(<input type="file">), that file name is normal.
how can i solve this problem..?
in advance, thanks~when i attach files using netui:fileUpload tag, korean file names are broken.
charset of my jsp page is UTF-8.
<%@ page language="java" contentType="text/html;charset=UTF-8"%>
chinese and japanese can be used, so default charset can not be changed to EUC-KR.
but other data of netui:textBox or netui:select are normal.
and when using normal html tag(<input type="file">), that file name is normal.
how can i solve this problem..?
in advance, thanks~ -
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 / matthewerror 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
-
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;} -
How to pre-select in netui:select
I am new to workshop. I need to use netui:select for a list box with multiple selection. I want to pre-select the listbox with several entries. I am wondering how to do this?
Cindy,
You can set multiple default values on a select tag by binding the
defaultValue attribute to a String[] or anything else (collection, etc)
that can be turned into an Iterator.
For example, here is how I modified Workshop's Sample Application
(specifically the "select multiple" example)
<netui:form action="submit">
<netui:select multiple="true" dataSource="{actionForm.selections}"
size="5" defaultValue="{pageInput.defaultValues}">
<netui:selectOption value="red" />
<netui:selectOption value="blue" />
<netui:selectOption value="green" />
<netui:selectOption value="yellow" />
<netui:selectOption value="orange" />
</netui:select>
<netui:button type="submit" value="Submit"/>
</netui:form>
here is the code from the controller showing the page flow variable
defaultValues being passed to the page as a page input in fhe Forward
contstructor.
private String[] defaultValues = {"green", "yellow"};
* @jpf:action
* @jpf:forward name="success" path="index.jsp"
protected Forward begin()
return new Forward("success", "defaultValues", defaultValues);
- john
"Cindy" <[email protected]> wrote in message
news:407170f4$[email protected]..
I am new to workshop. I need to use netui:select for a list box withmultiple selection. I want to pre-select the listbox with several entries.
I am wondering how to do this? -
How can I display selected tags across multiple e-mail addresses?
I receive email on a specific topic but via several e-mail addresses. How can I view selected tags where the resulting e-mails span several (7) email addresses. They are all active on my Thunderbird, but as far as I know, I can only display the selected tag on one of them at a time.
Any assistance greatly appreciated as this is a very big problem for me.
thanks, Ron75This solution does not appear to work across multiple e-mail addresses.
Perhaps I should have said "work across multiple e-mail address at the same time. I get e-mail on specific topics via several email addresses and wish to view all the tagged emails regardless of which email account in which they reside.
I could not get this solution to select more than one email account at a time. -
My web page has a select tag and cfselect tags and when I print the page with a different option other than the originally selected option the print for both types of select tags reverts back to the original selection and ignores the new selection. This happens in IE9 and .cfm files but not when the page is printed in IE8 or IE7 modes (tried in the F12 Developer Tools.) It also needs to be a .cfm file. FireFox printed the pages correctly for any combination.
This was done on a Dell and ThinkCentre computers under Windows 7. Also, I was able to reproduce the same problem on an different university web site where a selection box would revert back to the original selection for printing on a .cfm page and would print properly on a .PHP page at the same site.
For my site, I used a print button which calls print() and right clicked and chose print and got the same results no matter which method was used. I only had the right click method on the third party web site.
I know this is probably a bit narrow an issue but, any help would be appreciated.It appears that it is probably an IE9 bug.
I simplified the problem by turning the page source taken from the brouser of the original .cfm into an html file and found that it would still print improperly.
When I eliminated the various parts of the file I found that it would print correctly only when I removed the first line, the "DOC type" line.
The page will print the newly selected option but then I lose the style sheet.
If it does not work in an HTML file it must be IE. It is not the .cfm. The reason that it did not work for .cfm files, is that they always have a "DOC type" statement.
I have put the issue into an MSDN forum in addition to the one mentioned previously.
Maybe you are looking for
-
New MacBook Pro , not sure what the issue is.
While playing audio through iTunes, within 30 minutes or so, the sound will either stop or just start sounding really staticy and freezes every few seconds. Also iTunes sometimes just stops responding, I'll have to reboot and the same files giving me
-
Hello, I am trying to see IR/GR differences in MR11 transaction for a PO that belong to SRM system. I put all values for this PO and when I execute the transaction I don´t have any answer... The PO has 0 as GR and 16,14 as IR when the value for the i
-
I keep getting an error message from the same site. I have loaded this version of Adobe 3x, and other computers have no problem getting in. "To view the full contents of this document, you need a later version of the PDF viewer. You can upgrade to th
-
Search DIR for which GOS is used
Dear Friends, I want to perform a search for DIRs for which users have used GOS to attach files. please let me know if there are any link tables between DRAW and GOS. Presently GOS is not disabled for DMS, hence users are able to attach files using c
-
Installation of OSB on top of SOA 11g
Hi Gurus/Experts, I have installed Oracle SOA Suite 11g(11.1.1.5.0) in my system and working fine as of now.But now I want to install OSB on top of this, so can I install OSB or do I need to deinstall Oracle SOA Suite11g and then freshly install OSB