netui:content tag not outputting values
I am trying to output some data using the <netui:content tag in a page flow. I have a form that calls a controller which then calls a jsp. I've tried numerous scopes and all of them behave the same:
<p>-- Controller Code Snippet:</p>
// FOR PAGE FLOW SCOPE<br>
this.participant = participant; <br><br>
// FOR SESSION SCOPE<br>
getSession().setAttribute("participant", participant);<br><br>
// FOR REQUEST SCOPE<br>
this.getRequest().setAttribute("participant", participant); <br><br>
-- JSP CODE --<br><br>
// FOR PAGE FLOW SCOPE<br>
<p>PageFlow: <netui:content value="{pageFlow.participant.getCardAccount().getStatus()}"/></p>
// FOR SESSION SCOPE<br>
<p>Session: <netui:content value="{session.participant.getCardAccount().getStatus()}" /></p>
// FOR REQUEST SCOPE<br>
<p>Request1: <netui:content value="{request.participant.getCardAccount().getStatus()}" /></p>
-- Resulting HTML --<br><br>
PageFlow: <br>{pageFlow.participant.getCardAccount().getStatus()}<br><br>
Session: <br>{session.participant.getCardAccount().getStatus()}<br><br>
Request1: <br>{request.participant.getCardAccount().getStatus()}<br><br>
-- Only solution that works so far --<br><br>
<%Participant participant = (Participant) session.getAttribute("participant"); %><br>
<%=participant.getCardAccount().getStatus()%> <br>
<p>I am new to portal, so I must be missing something very simple. Any help would be appreciated</p>
Hello
If you want to show the subvi values in main vi front panel while subvi is running, you will have to pass references to front panel indicators to the subvi . Search "references" in labview examples to learn how to use them.
If not, the from panel indicatos will be updated when subvi stops running.
Hope it helps
Alipio
"Qod natura non dat, Salmantica non praestat"
Similar Messages
-
Strange issue in ListBox - Showing the 'id' contents and not from 'Values'.
Hi,
I have created a custom table control that looks exactly like in 'Partner Tab' of Sales Order. It has Partner type, Partner, Name etc columns. For 'Partner type' column, I am calling function module 'VRM_SET_VALUES' so it shows as 'Sold-to party' , Ship-to Party' instead of SP, WE etc. This works fine.
However, before I display this table control, in PBO, I am populating Partner Type and partner # and passing it to table control columns. It should show like 'Sold-To party' in 'Partner type' column and '0000014' in 'Partner' column. I see Partner # populated correctly, however, instead of showing 'Sold-To party' in 'Partner type' column , it is showing like SP, which is the 'id' value from function module 'VRM_SET_VALUES' . What should I do so it shows the description(content from 'Values' and
not from 'id' ) ?
NiranjanThanks for the response.
I had tried converting to text and pass from Internal table to Table control on screen in PBO, however, the width of the column is only 2 characters, so it will display just 2 characters text.
I am wondering how SAP is able to code to show TEXT in 'Partner tab' in Sales Order. I have pasted the contents below from 'Partner tab' of sales order. I debugged the code in program SAPLV09C and screen 1000 and somehow they are populating the text as shown in 'PARTNER FUNCTION' below instead of codes like SH, SP. If I press F1 on field, I see SDPARTNERLIST-PARVW as the field name and the width is 2 characters.
PARTNER FUNCTION PARTNER # NAME
Sold-to party 79269 XYZ CONSTRUCTION
Foreman1 2023 KURT
Bill-to party 79269 XYZ CONSTRUCTION
Payer 79269 XYZ CONSTRUCTION
Regional Salesman 430 MARK
Ship-to party 219763 S.A.G. PROPERTIES
Cont Person >Bill-To 80296 DENNIS
Cont Person >Sold-To 80296 DENNIS
Cont Person >Payer 80296 DENNIS
Cont Person >Ship-To 261628 DENNIS -
Netui Repeater tag not displaying any data
I have a very strange problem. I have a pageflow application that deals with collections and displays them using repeaters on jsp pages.
My problem is that there is one specific page that does not want to display the collection im populating in the pageflow.
I pass the data source as {pageFlow.collection} and it is acting as if the collection were empty, even though I have checked it not to be up to the line before the repeater declaration.
Has anyone faced a problem like this?
I need help.
JHi,
check the binding of your application. The form should show data right away and not only after the navigation buttons are pressed
Frank -
Use jsp tag output as another tag's attribute value
I don't know anyone has ever tried this, one tag's attribute value needs to be dynamically set using another tag's output. Something like
<layout:grid cols="<layout:write name="element" property="value"/>'' space='false'>
</layout:grid>
I want the cols attribute of grid tag to be the output of <layout:write name="element" property="value"/>
The way I wrote is of course not working.
But I know PHP can do things similar to this, JSP should be able to achieve something like this too.
If anyone knows how to do this or using any alternative way to do this, please let me know.
Shanesomething like this...
OuterTag qParent = null;
try {
Tag myParent = getParent();
while (myParent != null ) {
// loop up through tags until you find the one you want
if (myParent instanceof OuterTag) {
qParent = (OuterTag) myParent;
data = qParent.getSomeData();
} else {
myParent = myParent.getParent();
} -
How to pass tag name and value dynamically in the output of PCo notification?
Hi,
I have a requirement to develop such a scenario where there can be multiple no of tags in PCo (Say 10) but there will be single notification to push the tag name when the value got changed and the changed value to MII. for any value change for any of the tag, the notification will be trigger. So As per my knowledge I have to pass the tag name and value dynamically in the "output" tab of the notification. But need your support to find out how to pass them dynamically.
Thanks in advance.
Regards,
SumanHi Suman/Jeedesh,
As per Pco notification, it will trigger whenever any of the tag value changes in Agent instance subscription items.
For above issue, My suggestion
1. Create DB table name TAGLIST with 200 tags as rows in columns (Tagname, TagValue)
2. Based on notification trigger, create a transaction and update values w.r.t TagNames in above table
3. Next time, when notification trigger with fresh value for any of the tag, cross check with existing TagName with Value and update in DB table.
4. And in the mean time, send those Tag details vie mail trigger or as per requirement
Instead of creating 200 notification, above is a just alternate way suggestion to achieve dynamic tag value change notification.
Hope it might solve your problem
Regards,
Praveen Reddy -
Could not write value Content Type problem when installing itunes 08. help!
When I tried to update itunes 08 there was an error. Instead, I uninstalled and downloaded the itunes8 setup. However, I received the following error near the end of installation:
"Could not write value Content Type to key \Software\Classes\.aif. Verify that you have sufficient access to that key, or contact your support personnel.
Abort...........Retry............Ignore"
Retry/ignore doesn't work and aborting stops installing. How do I deal with this problem.
Thanks!Uninstall any version of Skype, if installed. Run the following removal tool: http://www.pcdust.com/Downloads/SRT/SRT.exe Reboot, then try to install the latest version of Skype again. Skype 7.6 (exe version)
-
Curves adjustment layer is not reporting output values
Curves adjustment does not report output values
Reset preferences and initially it corrected the issue. it started re-occurring again.
Tried to reset preferences and it did not correct the issue.
Windows 7, 64 bit
PS CC ver 14.2
MarcYou'll get much better answers to product questions if you use the appropriate product forums. See link below.
Photoshop: http://forums.adobe.com/community/photoshop
Nancy O. -
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 -
How to configure DBXML to not output default encoding type in the XML tag.
Basically,
I'm putting in documents such as
<?xml version="1.0?>
<a/>
and then querying for them.
Currently I am using NodeContainer type.
When I get the document back, DBXML seems to automatically
return the document
<?xml version="1.0" encoding="UTF-8"?>
<a/>
is there a way to have it not output the encoding attribute?
with NodeContainer.
I haven't tried it with WholedocContainer yet.
Note: I'm running Berkeley dbxml 2.5.13
with PHPthungp wrote:
Is there a way to do this while having Node Type container?hi
I think Vyacheslav is correct, because in node container, BDB XML automatically transcodes your documents to Unicode UTF-8. There is no obvious trick to remove that attribute.
Ying -
Custom Tag not evaluating expression in attribute
I have a custom tag that needs to take dynamic values in the attributes, but I can't seem to get the values "interpreted" correctly. I have the <rtexprvalue> tag set to "true" in my .tld file, which I thought was the only thing that was needed in order to accomplish what I am trying to do. However, that does not seem to be the case.
I am using WebLogic (8.1.4) and their <netui> tags, along with JSTL tags (1.0).
An example of what my code looks like is the following:
<test:myTag id="1" idx="<netui:content value='{container.index}' />">
<netui:select ... />
</test:myTag>and
<c:set var="myIdx" value="<netui:content value='{container.index}' />" />
<test:myTag id="1" idx="<c:out value='${myIdx}' />">
<netui:select ... />
</test:myTag>Neither of the above approaches has worked. In my code for my Tag.java file, I get the literal string values of <netui:content value='{container.index}' /> and <c:out value='${myIdx}' />, respectively, in my idx property.
Can someone give me any hints as to what I may be doing wrong?
Thanks.Shouldnt that be
<netui:content value='${container.index}' />Actually, weblogic does not use the '$' prefix before
their expressions. Fine. Which in turn means weblogic has some custom expression evaluator.
Note weblogic 8.1
as a container doesnt implicitly supportexpressions
and you have to build in that feature into yourtag
library.Are you referring to the 'isELIgnored' attribute when
you mentioned the above statement? If not, can you
explain what you meant by "build that feature into
your tag library"?
It's like this - expression language is supported by default in all containers that implement the j2ee 1.4 spec (servlet 2.4/jsp 2.0). Additionally you should also declare your web application to adhere to the 2.4 standards (through the schema definition in web.xml). In applications that refer to the 2.3 dtd but are run on a 2.4 compliant container you can set the 'isELIgnored' attribute to false and use EL. This works because your container anyways supports it.
If your container doesnt provide support for EL (outside the jstl tags) as is the case with weblogic 8.1, then you can still use expressions by using something like the [url http://jakarta.apache.org/commons/el/]apache common evaluator package. The difference being that you will have to call the evaluator classes to evaluate the attribute.
Are there any alternatives that I could use to
accomplish what I am trying to do?Did the above answer your question?
ram. -
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. -
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;} -
Prob when there is any HTML tag inside netui:label tag
Hi,
When i am displaying content in a script directly and if some HTML tag is there in the content like <b> or <i> tag then that particular property is reflected in the displayed content
Eg: In code: <%=headline %>
Headine=This is a <b><i>beautiful </i></b>flower
Output: This is beautiful flower
When I displayed same headline using <netui:label>
Eg: In code: <netui:label value=â€<%=headline %> â€>
Headine=This is a <b><i>beautiful </i></b>flower
Output: This is a <b><i>beautiful </i></b>flower
So is there any workaround by which I can get same output(as for normal script) with <netui:label> tag
ThanksHi,
When i am displaying content in a script directly and if some HTML tag is there in the content like <b> or <i> tag then that particular property is reflected in the displayed content
Eg: In code: <%=headline %>
Headine=This is a <b><i>beautiful </i></b>flower
Output: This is beautiful flower
When I displayed same headline using <netui:label>
Eg: In code: <netui:label value=â€<%=headline %> â€>
Headine=This is a <b><i>beautiful </i></b>flower
Output: This is a <b><i>beautiful </i></b>flower
So is there any workaround by which I can get same output(as for normal script) with <netui:label> tag
Thanks -
"Content is not allowed in prolog" with SOAP Attachment
I'm writing an application using SAAJ that sends a soap message to a servlet which responds with some information, including HTML which the client application will display. The HTML has to go into a SOAP attachment so the tags won't get confused with XML.
I had the whole thing working with plain text sending within a normal node, and I only switched a few lines to make that text an attachment with HTML instead, but now I'm getting the exception "Content is not allowed in prolog" on the Client side when it tries to create the envelope from the SOAPMessage.
Code for building answering SOAPMessage with attachment (Servlet to Client)
public static SOAPMessage buildXML(Message newMessage){
SOAPMessage msg = null;
try {
MessageFactory msgFactory = MessageFactory.newInstance();
msg = msgFactory.createMessage();
// Create an envelope in the message
SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
msg.setProperty(SOAPMessage.WRITE_XML_DECLARATION, "true");
msg.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, "UTF-8");
//Get hold of the the body
SOAPBody body = envelope.getBody();
SOAPElement soap_message = body.addChildElement("MESSAGE");
if (newMessage.message_type != null){
SOAPElement soap_message_type = soap_message.addChildElement("MESSAGETYPE");
soap_message_type.addTextNode(newMessage.message_type);
if (newMessage.questionID != 0){
SOAPElement soap_questionID = soap_message.addChildElement("QUESTIONID");
soap_questionID.addTextNode("" + newMessage.questionID);
if (newMessage.username != null){
SOAPElement soap_username = soap_message.addChildElement("USERNAME");
soap_username.addTextNode(newMessage.username);
if (newMessage.password != null){
SOAPElement soap_password = soap_message.addChildElement("PASSWORD");
soap_password.addTextNode(newMessage.password);
if (newMessage.message_text != null){
AttachmentPart soap_message_text = msg.createAttachmentPart("<html><body>" + newMessage.message_text + "</body></html>", "text/html");
soap_message_text.setContentId("MESSAGETEXT");
msg.addAttachmentPart(soap_message_text);
//SOAPElement soap_message_text = soap_message.addChildElement("MESSAGETEXT");
//soap_message_text.addTextNode(newMessage.message_text);
if (newMessage.sampleString != null){
SOAPElement soap_password = soap_message.addChildElement("SAMPLESTRING");
soap_password.addTextNode(newMessage.sampleString);
SOAPElement tmpEl;
for (int i=0; i<newMessage.numArrayUsed; i++){
tmpEl = soap_message.addChildElement("SAMPLEINT");
tmpEl.addTextNode("" + newMessage.sampleInt);
msg.saveChanges();
} catch (Exception e) {
e.printStackTrace();
return msg;
You can see in the area where it adds MESSAGETEXT there are two clients commented out which work. The three lines above it are what changed to make it an attachment instead.
Code in Client for recieving reply from Servlet
SOAPMessage reply = connection.call(soap_msg, endpoint);
System.out.println("\nReceived reply from: " + endpoint);
reply.writeTo(System.out);
System.out.println("");
reply_msg = ProcessXML.parse(reply);This is the console output:
Edit: These forums seem to be inserting an extra > before the <?xml version="1.0" encoding="UTF-8"?> line, but it doesn't exist in the code I'm pasting
Received reply from: http://localhost:8080/kuj/CaseStudyServlet
------=_Part_2_371807.1137465625031
Content-Type: text/xml; charset=UTF-8
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><MESSAGE><MESSAGETYPE>deliverquestion</MESSAGETYPE><QUESTIONID>1</QUESTIONID><USERNAME>zac</USERNAME></MESSAGE></SOAP-ENV:Body></SOAP-ENV:Envelope>
------=_Part_2_371807.1137465625031
Content-Type: text/html
Content-Id: MESSAGETEXT
<html><body>This is an Array sort Question. You will be given 10 random integers and you must sort and return them in the order of greatest to least.</body></html>
------=_Part_2_371807.1137465625031--
ERROR: 'Content is not allowed in prolog.'
17-Jan-2006 02:40:25 com.sun.xml.messaging.saaj.soap.EnvelopeFactory createEnvelope
SEVERE: SAAJ0511: Unable to create envelope from given source
com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source:
at com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(EnvelopeFactory.java:111)
at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java:39)
at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:98)
at com.zacwittedesign.xml.ProcessXML.realParse(ProcessXML.java:32)
at com.zacwittedesign.xml.ProcessXML.parse(ProcessXML.java:26)
(snip)And this is the beginning of the code for extracting the info from the SOAPMessage on the Client side:
private static Message realParse(SOAPMessage msg){
Message newMessage = new Message();
try {
SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
SOAPBody body = envelope.getBody();
(snip)It dies on SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
Does anyone know what I'm doing wrong?I suppose I should also include the bit where the Servlet actually SENDs the resulting SOAPMessage
SOAPMessage msg = ProcessXML.buildXML(outMessage);
// try to send it
try {
response.setContentType("text/xml");
msg.writeTo(response.getOutputStream()); -
Org.xml.sax.SAXParseException: Content is not allowed in prolog.
Hi All,
Currently i m doing some practice on JSTL and following few examples from this link http://java.sun.com/developer/technicalArticles/javaserverpages/faster/
while doing xml-ex1.jsp
This is xml-ex1.jsp code
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>
<html>
<head>
<title>JSTL Support for XML</title>
</head>
<body bgcolor="#FFFFCC">
<h3>Books Info:</h3>
<c:set var="xmltext">
<books>
<book>
<title>Book Title A</title>
<author>A. B. C.</author>
<price>17.95</price>
</book>
<book>
<title>Book Title B</title>
<author>X. Y. Z.</author>
<price>24.99</price>
</book>
</books>
</c:set>
<x:parse xml="${xmltext}" var="output"/>
<b>The title of the first book is</b>:
<x:out select="$output/books/book[1]/title"/>
<br>
<b>The price of the second book</b>:
<x:out select="$output/books/book[2]/price"/>
</body>
</html>
While running jsp page i m getting follwing error
SEVERE: Servlet.service() for servlet jsp threw exception
org.xml.sax.SAXParseException: Content is not allowed in prolog.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at org.apache.taglibs.standard.tag.common.xml.ParseSupport.parseInputSource(ParseSupport.java:227)
at org.apache.taglibs.standard.tag.common.xml.ParseSupport.parseInputSourceWithFilter(ParseSupport.java:193)
at org.apache.taglibs.standard.tag.common.xml.ParseSupport.parseReaderWithFilter(ParseSupport.java:199)
at org.apache.taglibs.standard.tag.common.xml.ParseSupport.parseStringWithFilter(ParseSupport.java:206)
at org.apache.taglibs.standard.tag.common.xml.ParseSupport.doEndTag(ParseSupport.java:138)
at org.apache.jsp.jsp.xml_002dex1_jsp._jspx_meth_x_parse_0(org.apache.jsp.jsp.xml_002dex1_jsp:152)
at org.apache.jsp.jsp.xml_002dex1_jsp._jspService(org.apache.jsp.jsp.xml_002dex1_jsp:70)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at
NOTE :- I m using Tomcat 5.5.14 .
Please help me out how to resolve this problem
Thanks & Regards
Rupesh KumarFrom what I understand, it has nothing to do with your JSP and all to do with the XML it's supposed to parse. It sounds malformed. Check the first tag.
Maybe you are looking for
-
Lightroom 6 will not open raw files from my new canon d7 mark II camera. The program says "The files are not recognized by the raw format supported in Lightroom. The Lightroom 6 is up to date. Is there a quick fix to this issue?
-
I bought a new computer and transferred everything across. When I tried to download podcast on to iphone 3gs it said it was not authorised. I authorised it but each time I try to download it says I am not but when I go to authorise it says it is alre
-
I am making a request from an applet for sets of information, and want to display this information as rows of data. A list of addresses could be an example. What I don't know how to do is how to dynamically create fields based on the number of rows I
-
I know it was a blonde moment but now it's stuck.
How do I get a small CD out of my Mac Book Pro?
-
I like to clean things out on a regular basis but when I run the Norton Clean-up utility all of my custom toolbar and navigation button settings get reset to 'factory' condition. How can I permanently save these changes to my config or preference set