Nested tags with a List of Objects
I'm having trouble getting nested tags to work. Here's an example:
My form has a List that contains a Bean called Car as well as a getter and a setter. The Car Bean has three String attributes: color, model and manufacturer. Getters and setters are present.
When I navigate to the form, my Action class creates a single Car and adds it to the list: when the page loads I am presented with three text fields representing my Car bean. Good.
However when I enter some text into the fields and hit the save button I get the following error:
Error 500: BeanUtils.populateI've read a bit about nested tags but still I can't figure out what exactly I'm doing wrong.
Here is a small sample of the JSP code;
<html:form action="/addCar.do">
<nested:iterate name="carForm" property="carList" type="com.foo.bean.CarBean">
<nested:text property="color"></nested:text>
<nested:text property="model"></nested:text>
<nested:text property="manufacturer"></nested:text>
</nested:iterate>
</html:form>Should I be doing something else to properly use a nested tag? Please let me know if more details are required.
Thank you,
David
I am using crystal reports to show names of a bunch of people. insted of each name comes form different function inside the oracle package, I would like to have a single function with an array of names so that I can return it easily
eg; board member 1 (from function 1)
board member 2 (from function 2)
board member 3 (from function 3)
I should get something like board member n(from a single function that has n number of members) , so that its easy for managing the list later and reduce the code
This sounds so silly, but i am new to both crystal and pl/sql....
please help
Similar Messages
-
Entity object attribute with a list of objects
Does anyone know how one sets up an entity object that has an attribute with a list of objects as the type? (assuming that's supported)
as in:
CREATE TYPE phones AS VARRAY(10) OF varchar2(10);
Create table suppliers (supcode number(5),
Company varchar2(20),
ph phones);
The SOA Suite in jDeveloper (new Entity Object/attributes etc) has an ARRAY that can point to REF or OBJECT. Neither work. When I try to Create DB Object later from the Entity Object I've created I get an invalid type.What you suggested about "validation codes on the VO" is not written on the ADF Documentation.
I try to blindly/strictly follow best practices (particularly on Validations, using Declartive and/or built in validators) on most ADF documentation and blogs but there are many scenarios on coding some large ADF projects that I think must veer away from the best practices stated on the documentation or maybe add new rules on the documentation depending on how complex an ADF project would be.
I religiously followed best practices stated on the documentation to use Entity and Attribute Validators when performing validations. What I did was i had created lots of Custom Validators (by implementing JboVAlidatorInterface interface) for each of the attributes on an Entity Object that need validated. So those validator is valid only for one attribute, its not reusable. And those validation codes either have reference to a ViewObject or call some PL/SQL procedure. So at some point are codes became messy.
Ultimately the whole project became harder to manage when the codes became large. Now I am trying to refactor the whole application by separating it into project/package and I am hoping to do it with little Re-coding as possible.
Hope to get your opinion on this one.
regards,
Anton -
Conditional build tags with numbered lists
Hi, I am using conditional build tags to create a separate
version of our product help file for a cut down version of the
software. In our help instructions we use numbered tasks for
explaining how to complete a process.
Where some steps aren't required for the cut down version,
the numbering does not auto-update accordingly - is there a way to
resolve this?
Thanks
Richard.Sorry I was talking rubbish. If this can be deleted please go
ahead. -
Custom taglib with nested tag not working
Hi everybody,
I have a question concerning a custom taglib. I want to create a tag with nested child tags. The parent tag is some kind of iterator, the child elements shall do something with each iterated object. The parent tag extends BodyTagSupport, i have overriden the methods doInitBody and doAfterBody. doInitBody initializes the iterator and puts the first object in the pageContext to be used by the child tag. doAfterBody gets the next iterator object and puts that in the pageContext, if possible. It returns with BodyTag.EVAL_BODY_AGAIN when another object is available, otherwise BodyTag.SKIP_BODY.
The child tag extends SimpleTagSupport and does something with the given object, if it's there.
In the tld-file I have configured both tags with name, class and body-content (tagdependent for the parent, empty for the child).
The parent tag is being executed as I expected. But unfortunately the nested child tag does not get executed. If I define that one outside of its parent, it works fine (without object, of course).
Can somebody tell me what I might have missed? Do I have to do something special with a nested tag inside a custom tag?
Any help is greatly appreciated!
Thanks a lot in advance!
Greetings,
PeterHi again,
unfortunately this didn't work.
I prepared a simple example to show what isn't working. Perhaps it's easier then to show what my problem is:
I have the following two tag classes:
public class TestIterator extends BodyTagSupport {
private Iterator testIteratorChild;
@Override
public void doInitBody() throws JspException {
super.doInitBody();
System.out.println("TestIterator: doInitBody");
List list = Arrays.asList(new String[] { "one", "two", "three" });
testIteratorChild = list.iterator();
@Override
public int doAfterBody() throws JspException {
int result = BodyTag.SKIP_BODY;
System.out.println("TestIterator: doAfterBody");
if (testIteratorChild.hasNext()) {
pageContext.setAttribute("child", testIteratorChild.next());
result = BodyTag.EVAL_BODY_AGAIN;
return result;
public class TestIteratorChild extends SimpleTagSupport {
@Override
public void doTag() throws JspException, IOException {
super.doTag();
System.out.println(getJspContext().getAttribute("child"));
System.out.println("TestIteratorChild: doTag");
}The Iterator is the parent tag, the Child shall be shown in each iteration. My taglib.tld looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<taglib
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee web-jsptaglibrary_2_1.xsd"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1">
<tlib-version>1.0</tlib-version>
<short-name>cms-taglib</short-name>
<uri>http://www.pgoetz.de/taglibs/cms</uri>
<tag>
<name>test-iterator</name>
<tag-class>de.pgoetz.cms.taglib.TestIterator</tag-class>
<body-content>tagdependent</body-content>
</tag>
<tag>
<name>test-iterator-child</name>
<tag-class>de.pgoetz.cms.taglib.TestIteratorChild</tag-class>
<body-content>empty</body-content>
</tag>
</taglib>And the snippet of my jsp is as follows:
<!-- TestIterator -->
<cms:test-iterator>
<cms:test-iterator-child />
</cms:test-iterator>The result is that on my console I get the following output:
09:28:01,656 INFO [STDOUT] TestIterator: doInitBody
09:28:01,656 INFO [STDOUT] TestIterator: doAfterBody
09:28:01,656 INFO [STDOUT] TestIterator: doAfterBody
09:28:01,656 INFO [STDOUT] TestIterator: doAfterBody
09:28:01,656 INFO [STDOUT] TestIterator: doAfterBody
So the child is never executed.
It would be a great help if anybody could tell me what's going wrong here.
Thanks and greetings from germany!
Peter
Message was edited by:
Peter_Goetz -
Help with nesting tags (STRUTS)
Hi,
I'm having a few problems with the following nested tag:
<input name="indicator_target_<bean:write name='indicators' property='indicator_id'/>" size="10" value="<bean:write name="TargetValuesActionForm" property="indicator_target_<bean:write name='indicators' property='indicator_id'/>"/>"/>
The page returns no getter method for "indicator_target_", but i'm not trying to get the "indicator_target_" value i'm trying to get the "indicator_target_ + id" (i.e. indicator_target_23) value. For some reason the nested _<bean:write name='indicators' property='indicator_id'/> tag which is part of the input 'value' param is being ignored?
anyone know how I can resolve this?One of the first rules of JSP custom tags - you cannot use a tag as an attribute to another tag. For dynamic attributes you have to use a runtime expression. - either <%= expr %> or in a JSP2.0 container ${expr} as well.
Your "input" tag is plain template html. So you can use custom tags for the values of the attributes.
The one that is failing is
<bean:write name="TargetValuesActionForm" property="indicator_target_<bean:write name='indicators' property='indicator_id'/>"/>
I am presuming you are in a logic:iterate loop, or equivalent.
Something like this might work:
<bean:define id="currentId" name='indicators' property='indicator_id'/>
<bean:write name="TargetValuesActionForm" property="<%= "indicator_target_" + currentId %>"/>However all of this is very nasty.
And struts can do at least part of this for you with indexed properties. You might want to take a look at them.
Hope this helps,
evnafets -
Tag files, Lists, and object typing
I'm passing a list of objects to a custom tag, created via a tag file.
I can access object properties in the jsp page like this -
<c:out value="${listOfItems[0].property}" />
but inside the tag it doesn't work. It understands that its being passed a list and the number of items in the list but not the type of objects in the list. I think I need to declare the type of object that the list is returning but I'm unsure of th jstl way of doing this.
advice?
thanksJSTL uses introspection/reflection to call methods/access properties.
It doesn't have to know the type of object in the list.
How are you accessing this object in your tag file? Using EL again? That should work fine. If you use java/scriptlet code then you will need to cast the object.
Have you declared the attribute that is being passed in? What type are you expecting? Default is String unless you specify otherwise. -
SOAP Help Building Request With Nested Tags
I have been struggling with Apache SOAP to try and build a request. Specifically, I don't understand how to embed these elements into the Header and Body sections. More specifically, how to do this nested tags.
Thanks for any advice you can provide.
Below, is a sample of the request I need to send to the server.
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Header>
<ContinueHeader xmlns="http://www.openuri.org/2002/04/soap/conversation/">
<uniqueID>111111111111111</uniqueID>
</ContinueHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<subscribe xmlns="http://xxxx/xxxx/xxxx/service">
<comHdr>
<WSCredentials>
<UserName>xxxxxxx</UserName>
<Password>xxxxxxxx</Password>
</WSCredentials>
</comHdr>
</subscribe>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>I can add the <UserName>xxxxxxx</UserName> <Password>xxxxxxxx</Password> to the body of the request using:
Vector parms = new Vector();
parms.addElement(new Parameter("UserName", String.class, username, null));
parms.addElement(new Parameter("Token", String.class, password, null));
call.setParams(parms);I just don't know how to add those tags within the <comHdr> and <WSCredentials> tags. -
Loading an XML with multiple nested tags
I've got some problems dealing with loading a nested tags XML file.
Let's suppose I have such a very simple myxml.xml file:
<ROWDATA>
<ROW>
<EMPNO>7369</EMPNO>
<ENAME>SMITH</ENAME>
</ROW>
<ROW>
<EMPNO>7902</EMPNO>
<ENAME>FORD</ENAME>
</ROW>
</ROWDATA>
I can create the following table:
create table EMP
empno NUMBER(4) not null,
ename VARCHAR2(10),
and then inserting the XML file in this way:
insert into EMP
(empno, ename)
select extractvalue (column_value, '/ROW/EMPNO'),
extractvalue (column_value, '/ROW/ENAME'),
from table
(xmlsequence
(extract
(xmltype
(bfilename ('MY_DIR', 'myxml.xml'),
nls_charset_id ('AL32UTF8')),
'/ROWDATA/ROW')))
so as to get inserted two rows into my table:
EMPNO ENAME
7369 SMITH
7902 FORD
Now, and this is my question, let's suppose I have such a “more difficult” XML:
<ROWDATA>
<ROW>
<COMPANY>
<EMPNO>7369</EMPNO>
<ENAME>SMITH</ENAME>
<EMPNO>1111</EMPNO>
<ENAME>TAYLOR</ENAME>
</COMPANY>
</ROW>
<ROW>
<COMPANY>
<EMPNO>7902</EMPNO>
<ENAME>FORD</ENAME>
</COMPANY>
</ROW>
<ROW>
<COMPANY>
</COMPANY>
</ROW>
</ROWDATA>
In this case it seems to me things look harder 'cause for every row that I should insert into my table, I don't know how many “empno” and “ename” I'll find for each /ROW/COMPANY and so how could I define a table since the number of empno and ename columns are “unknown”?
According to you, in that case should I load the whole XML file in an unique XMLType column and than “managing” its content by using EXTRACT and EXTRACTVALUE built-in funcions? But this looks a very difficult job.
My Oracle version is 10gR2 Express Edition
Thanks in advance!Here's a possible solution using a single pass through the XML data :
with sample_data as (
select xmltype(
'<ROWDATA>
<ROW>
<COMPANY>
<EMPNO>7369</EMPNO>
<ENAME>SMITH</ENAME>
<EMPNO>1111</EMPNO>
<ENAME>TAYLOR</ENAME>
</COMPANY>
</ROW>
<ROW>
<COMPANY>
<EMPNO>7902</EMPNO>
<ENAME>FORD</ENAME>
</COMPANY>
</ROW>
</ROWDATA>'
) doc
from dual
select min(case when node_name = 'EMPNO' then node_value end) as empno
, min(case when node_name = 'ENAME' then node_value end) as ename
from (
select trunc((rownum-1)/2) as rn
, extractvalue(value(x), '.') as node_value
, value(x).getrootelement() as node_name
from sample_data t
, table(
xmlsequence(extract(t.doc, '/ROWDATA/ROW/COMPANY/*'))
) x
group by rn ;
I would be cautious with this approach though, as I'm not sure the ROWNUM projection is entirely deterministic.
As Jason said, it's probably safer to first apply a transformation in order to get a more friendly format.
For example :
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="COMPANY">
<xsl:apply-templates select="EMPNO"/>
</xsl:template>
<xsl:template match="EMPNO">
<EMP>
<xsl:copy-of select="."/>
<xsl:copy-of select="following-sibling::ENAME[1]"/>
</EMP>
</xsl:template>
</xsl:stylesheet> -
How to use nested tag in Struts
Hi..
Can any one guide me how to use nested tag in Struts. So far i already tried bean tag with no error but when i try to use nested tag i got error like
javax.servlet.ServletException: Cannot find bean: "" in any scope
Below are my class:
action class
session.setAttribute ("MyDetailList", detailList);
JSP page
<logic:iterate id="list" name="MyDetailList">
Company ID : <bean:write name="list" property="companyID" />
</logic:iterate>
For bean tag, i got no error at all and below are my code for nested tag
action class
session.setAttribute ("MyDetailList", detailList);
JSP Page
<nested:nest property="MyDetailList">
Make : <nested:text property="make"/>
Car ID : <nested:text property="carID"/>
</nested:nest>
When i run the code, i got error message
javax.servlet.ServletException: Cannot find bean: "" in any scope
Any body can help me?
zulwhat am I doing wrong?You will notice above that I mentioned
YOU CAN'T USE CUSTOM TAGS AS ATTRIBUTES TO OTHER CUSTOM TAGS
(was that loud enough for you to notice this time)?
Try
<html:text styleId="instruction" styleClass="text" size="50" name="instruction" property="value"/>
//or
<html:text styleId="instruction" styleClass="text" size="50" property="instruction" value="<%= instruction.getValue() %>"/>
better alternative: populate your formbean with your action and just have:
<html:text styleId="instruction" styleClass="text" size="50" property="instruction"/>
If you set the "instruction" property of your formBean in the action, the value will be automagically reflected here.
Cheers,
evnafets -
Hi all
Here is my XML file structure
<book>
<section title="My Life">
<p>
<ol>
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
<li>item 4
<ol>
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
</ol>
</li>
</ol>
</p>
</section>
</book>
I need to do two things from my XML file
one
I have a problem with importing my xml file. I have nested tags in my xml file. list inside list. While I am mapping tags to styles I am hang I can’t map different styles to my nested list 2nd level list. I am working with IDCS3. Is there any way to map my nested tag?
in short
list level One > Item 1
TagName: <li>
Paragraph style>ListIndentOne
list level Two > Item 1
TagName: <li>
Paragraph style>ListIndentTwo
two
The next problem is I need to pint the value of my tag variables into indesign document is this is possible?
<section title="My Life">
I need to print the value of the variable value "My Life" as title style in my document.
thanks in advance
reagrds
a r u lHi all
Here is my XML file structure
<book>
<section title="My Life">
<p>
<ol>
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
<li>item 4
<ol>
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
</ol>
</li>
</ol>
</p>
</section>
</book>
I need to do two things from my XML file
one
I have a problem with importing my xml file. I have nested tags in my xml file. list inside list. While I am mapping tags to styles I am hang I can’t map different styles to my nested list 2nd level list. I am working with IDCS3. Is there any way to map my nested tag?
in short
list level One > Item 1
TagName: <li>
Paragraph style>ListIndentOne
list level Two > Item 1
TagName: <li>
Paragraph style>ListIndentTwo
two
The next problem is I need to pint the value of my tag variables into indesign document is this is possible?
<section title="My Life">
I need to print the value of the variable value "My Life" as title style in my document.
thanks in advance
reagrds
a r u l -
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;} -
Combing jstl/xml tags with jsf - can't pass parameter
I'm using the jstl/xml tags to parse portions of an xml document. For some value of an attribute I want to render a search link, many of these links may be rendered on a page and I need to track which one has actually been selected using the id of the generating xml element.
This is what I've tried, both using h:commandLink and a f:param and t:commandLink (tomahawk) and a t:updateActionListener.
It doesn't seem to be possible to expose the resolved value of the xpath ="@id" in any way that either the tomahawk or core jsf tags can see.
<x:when select="$control[@type='SEARCH']">
<input type="text" id='<x:out select="@id"/>' disabled="true">
<x:set var="selectedId" select="@id"/>
<h:commandLink action="#{pack.search}" value="#{msg['actionPack.label.search']}" styleClass="linkNoUnderline">
<f:param value="${selectedID}" name="selectedID"/>
</h:commandLink>
<%--<t:commandLink action="#{pack.search}" value="#{msg['actionPack.label.search']}" styleClass="linkNoUnderline">
<t:updateActionListener property="#{pack.searchingId}" value="${searchId}"/>
</t:commandLink>--%>
</x:when>The JSF and JSTL tags don't really play well together.
Particularly conditional and looping tags.
My suggestion would be - if you're using JSF, don't use JSTL.
You are right in that the JSF tags don't bother with the xpath expression.
Would it be possible to shift the xml logic into an action/bean somewhere, and just present the jsp page with a list of relevant objects?
If I understand you are trying to determine which link was clicked on a page? In the JSF action "pack.search"?
What method of iterating are you using? an x:forEachLoop? A datatable? -
Excel Services with SharePoint List Data in SharePoint 2013 - Chart is not refreshing automatically
Hi Everyone,
This is My req: I m going to display pie chart and Bar chart in share point 2013.
Steps I have follwed:
1. Export the list to excel.
2.Using the Power Pivot table I have done the chart.
3. Uploaded into document Library.
4. Added into the web part.
Chart are displaying. But When ever user added the data into the list chart is refreshing.
Is there any option to refresh the data in chart? Waiting for valuable replies.
Regards, Manoj PrabakarSharePoint lists as data sources in Excel Services is not supported.That's the reason refreshing is not working. There are some work around you can use -
Export as Data Feed - Export your SharePoint list as Data Feed , use this data feed to a PowerPivot for Excel workbook and publish this PowerPivot using Excel Services.
User-defined functions - write UDF in C# and extend the Excel Services functionality to work with SharePoint lists.
https://msdn.microsoft.com/library/bb267252(office.12).aspx#Office2007ExcelServicesUnlimited_SharePointLists
Web Services API -
The Web Services API can be used to push data from a database and then refresh the data in a SharePoint Server list by using Excel Services.
JavaScript Object Model - The JavaScript Object Model for Excel Services in Microsoft SharePoint Server 2010 provides many solutions for Excel Services.
More details -
https://technet.microsoft.com/en-us/library/gg576960.aspx
Thanks
Ganesh Jat [My Blog |
LinkedIn | Twitter ]
Please click 'Mark As Answer' if a post solves your problem or 'Vote As Helpful' if it was useful. -
SSRS reporting with sharepoint list using Distinct and Multivalue parameters
i want create ssrs report with sharepoint list using ms-vs(2008). i want create Distinct multivalue parameters by using CAML query. There is any way we put CAML query where we use Distinct keyword and IN clause in CAML query... i hope all experts will
understand my poor English... sorry for poor English.. plz help meHi AsifMehmood,
Per my understanding you have create an SSRS report with SharePoint list, now you don’t know to create the distinct parameters by using CAML query, right?
For the CAML language doesn’t have any reserved word (or tag) to set this particular filter to remove duplicate results, but we can use the custom code to do this function. I have tested on my local environment and we can do that by create one hidden parameter(Param1)
to get all the values from the fields which will add the filter and then create another parameter(Param2) to get the distinct values based on the Param1, we use the custom code to do the deduplication.
Step by Steps information in below thread for your reference to create the parameters and the custom code:
"How to get distinct values of sharepoint column using SSRS"
Other similar thread for your reference:
https://audministrator.wordpress.com/2014/02/17/sharepoint-list-add-distinct-parameter-value/
If your problem still exists, please feel free to ask and also try to provide us more details information.
Regards
Vicky Liu -
Loading Nested table with SQL Loader
We have 15 nested tables in an table. Need help in creating a contol file. Tried with the syntax of object collection and didn't work. Can any none share the syntax please.
-- Thanks,
Phani AdusumilliThanks Srini and Zoltan.
I am able to figure out, here is the example with one nested table.
CREATE OR REPLACE TYPE feature_count_type AS OBJECT (
feature_type VARCHAR2(60),
occurs INTEGER
CREATE OR REPLACE TYPE feature_count_ntbl
AS TABLE OF feature_count_type;
CREATE TABLE PHANI_ADUSUMILLI(
state VARCHAR2(2),
county VARCHAR2(20),
feature_count feature_count_ntbl
) NESTED TABLE feature_count
STORE AS nested_feature_count_table;
LOAD DATA
INFILE *
TRUNCATE INTO TABLE PHANI_ADUSUMILLI
county CHAR TERMINATED BY ',' ENCLOSED BY '"',
element_count FILLER INTEGER EXTERNAL TERMINATED BY ',',
feature_count NESTED TABLE COUNT(element_count)
dummy_name COLUMN OBJECT
feature_type CHAR TERMINATED BY ',',
occurs INTEGER EXTERNAL TERMINATED BY ','
state CHAR TERMINATED BY ','
BEGINDATA
"Alger",5,lake,213,stream,88,falls,18,bay,11,island,5,MI
"Marquette",6,lake,293,stream,145,falls,5,bay,8,island,5,summit,23,MI
"Keweenaw",3,lake,86,falls,1,summit,16,MI
Maybe you are looking for
-
Can I able to view ASP pages in iplanet web server
can iplanet web server handle the ASP pages in Windows NT server. i tried but i might be wrong configuring it in content manager, anybodys help will be appreciated.
-
I have something I've never seen before and Googling is failing me. I have been working on a Windows server that is running a few Oracle instances. One of the many instances on the box always starts up with a nomount status and the listener shows it
-
How to import Flac files into itunes
Hi there, the title say it all. How can I import Flac files into Itunes? I have a lot of them. I click onto add to library select the flac file, click on open and nothing happen. Many thanks for your help. regards
-
I paid the $19.99 but was only allowed one conversion?
I was in adobe reader and wanted to use the online feature to convert a pdf to word. So, I paid the $19.99 and was able to convert one file, but now when I try to convert additional files I get routed to a screen that says I have zero conversions lef
-
This question was posted in response to the following article: http://help.adobe.com/en_US/creativesuite/cs/using/WSCA4C914B-B11F-46c6-ACE5-42F36ED1C7BC. html