How to pass more than one parameter using display tag? - struts

I'm using display tag. but i want to pass more than one parameter in the runtime. How can i pass the more than one parameter in the display:column using the 'paramProperty' and 'paramid'
My code is ,
<display:table name="${weeklyDlvyInstancesDashboardReportForm.asnAccuracyListQO}" uid="asnAccuracyListUID" sort="list" defaultsort="1"
requestURI="/weeklyDlvyInstancesDashboardReportPre.do?method=httpGet" excludedParams="method"
decorator="com.ford.mpl.superg.decorator.WeeklyDeliveryInstancesTypeTableDecorator" keepStatus="true">
<%#include file="/jsp/include/displaytag.jsp"%>
<c:set value="${asnAccuracyListUID.firstWeekOfCountLabel}" var="asnAccuracyFirstWeekOfCount"/>
<c:set value="${asnAccuracyListUID.secondWeekOfCountLabel}" var="asnAccuracySecondWeekOfCount"/>
<c:set value="${asnAccuracyListUID.thirdWeekOfCountLabel}" var="asnAccuracyThirdWeekOfCount"/>
<c:set value="${asnAccuracyListUID.fourthWeekOfCountLabel}" var="asnAccuracyFourthWeekOfCount"/>
<c:set value="${asnAccuracyListUID.fifthWeekOfCountLabel}" var="asnAccuracyFifthWeekOfCount"/>
<c:set value="${asnAccuracyListUID.sixthWeekOfCountLabel}" var="asnAccuracySixthWeekOfCount"/>
<c:if test="${(asnAccuracyListUID.instanceType != null && asnAccuracyListUID.instanceType != 'Sum')}">
<display:column property="instanceTypeDescription" title="Instance Type" sortable="false"/>
</c:if>
<c:if test="${(asnAccuracyListUID.instanceType != null && asnAccuracyListUID.instanceType == 'Sum')}">
<display:column property="instanceType" title="Instance Type" sortable="false" style="font-weight:bold;text-align:center"/>
</c:if>
<display:column property="firstWeekOfCount" title="${asnAccuracyFirstWeekOfCount}" href="${pageContext.request.contextPath }/weeklyDlvyInstancesDashboardReportPost.do?method=WeeklyDlvyInstExcelReport" paramProperty="instanceType,ratingElementId" paramId="instanceTypeForJSP,ratingElementIdForJSP" sortable="false" />
<display:column property="secondWeekOfCount" title="${asnAccuracySecondWeekOfCount}" sortable="false" />
<display:column property="thirdWeekOfCount" title="${asnAccuracyThirdWeekOfCount}" sortable="false" />
<display:column property="fourthWeekOfCount" title="${asnAccuracyFourthWeekOfCount}" sortable="false" />
<display:column property="fifthWeekOfCount" title="${asnAccuracyFifthWeekOfCount}" sortable="false" />
<display:column property="sixthWeekOfCount" title="${asnAccuracySixthWeekOfCount}" sortable="false"/>
</display:table>

Dont use this because it gives first row only as parameters
<display:table cellpadding="2" name="dl" id="data" pagesize="500" requestURI="dataDisplayFormOne.htm" class="main_grid_table">
<display:column property="facid" title="facid" href="printUserForm20.htm?factid=${data.facid}&Licensenumber=${data.LICENSE_NO_FORM20}" class="main_grid_column"/>
</display:table>

<display:column property="firstWeekOfCount" title="${asnAccuracyFirstWeekOfCount}" href="${pageContext.request.contextPath }/weeklyDlvyInstancesDashboardReportPost.do?method=WeeklyDlvyInstExcelReport&ratingElementIdFromJSP=${asnAccuracyListUID.ratingElementId}" paramProperty="instanceType" paramId="instanceTypeFromJSP" sortable="false"/>

You could simply generate the link yourself:
<display:column>
<c:url value="..." var="theUrl">
<c:param name="..." value="..."/>
<c:param name="..." value="..."/>
</c:url>
...
</display:column>

Related

Extracting Information from XML in SQL Server after performing a join

I have a SQL table create through the following code with the column UserDefinedXML that contains a information I need to be able to extract.
SELECT A.ExternalID, A.UserDefinedXML, A.ServiceSiteUid, A.LastModifiedDate, A.PersonUid,
B.FirstName, B.LastName, B.PersonUid,
C.Name
FROM Patient A
INNER JOIN Person B ON B.PersonUid = A.PersonUid
INNER JOIN ListServiceSite C ON C.ServiceSiteUid = A.ServiceSiteUid
WHERE A.UserDefinedXML IS NOT NULL
ORDER By LastModifiedDate
I have been extracting it through a lot of gsubs in R but that is inefficient and not the best way to go about it, I'm sure. The XML format is below
<data>
<LOA>
<NotMedNecessaryInsCompany ControlType="PrmTextBox" Value="" Label="" />
<DicontinuedDate ControlType="FindDateBox" Value="" Label="" Display="false" />
<ReceivedDate ControlType="FindDateBox" Value="" Label="" Display="false" />
<SentDate ControlType="FindDateBox" Value="" Label="" Display="false" />
<ReasonDiscontinued ControlType="PrmTextBox" Value="" Label="" />
<NoOONBenefitsInsCompany ControlType="PrmTextBox" Value="" Label="" />
<InsuranceStatus ControlType="PrmGroupBox" Label="" Value="" />
<OtherReasonDenied ControlType="PrmTextBox" Value="" Label="" />
<FacilityRefused ControlType="PrmCheckBox" Value="false" Label="Facility Refused" />
<ReasonDenied ControlType="PrmCheckBox" Value="false" Label="Other" />
</LOA>
<Forms>
<POReceivedDate ControlType="FindDateBox" Value="" Label="" Display="false" />
<InformedConsentReceivedDate ControlType="FindDateBox" Value="" Label="" Display="false" />
<AuthorizationToTreatReceivedDate ControlType="FindDateBox" Value="" Label="" Display="false" />
</Forms>
<Skin_Sheet>
<SkinSheet ControlType="PrmGroupBox" Label="No" Checked="PrmRadioButton1" Value="" />
</Skin_Sheet>
</data>
For the moment, I am just interested in whether "Yes" or "No" is selected in the last few lines under the SkinSheet header. Ultimately, I will need to be able to access all of the fields in this string. Unfortunately I am very inexperienced with SQL and have been thrown into it at work so I am trying to learn on the fly.
Assuming that UserDefinedXML is XML datatype, just use the value function:
SELECT A.UserDefinedXML.value('(//SkinSheet/#Label)[1]', 'varchar(100)'), other, columns
FROM ...

dataExporter cannot be rendered because of form needing

I am trying to add dataExporter component to my table.
First I had {Exporters} beside pagination facet , then after a lot of tries I got this error in the console
HTML nesting warning on closing changes: element update not explicitly closed
I solved it also but now there is nothing appears in the Exporter facet. I googled it and found that I need a form in my page because of this commandlink submit a form , so it needs a form.
My Question here is how to apply this example in my project.
Here is my code.
<ui:composition template="/template.xhtml">
<ui:define name="title">
<h:outputText value="#{bundle.ViewLfmTitle}"></h:outputText>
</ui:define>
<ui:define name="body">
<h:panelGroup id="messagePanel" layout="block">
<h:messages errorStyle="color: red" infoStyle="color: green"
layout="table" />
</h:panelGroup>
<p:dialog header="Add Task" widgetVar="dlg" position="center center"
onShow="PF('dlg').initPosition()" modal="true" closeOnEscape="true"
resizable="false">
<h:form>
<h:panelGrid columns="2">
<p:outputLabel value="#{bundle.CreateTaskLabel_name}" for="name" />
<p:inputText id="name"
value="#{ViewLfmJpaController.newTaskDTO.name}"
title="#{bundle.CreateTaskTitle_name}" />
<p:outputLabel value="#{bundle.CreateTaskLabel_durationPerMonth}"
for="durationPerMonth" />
<p:inputText id="durationPerMonth"
value="#{ViewLfmJpaController.newTaskDTO.duration}"
title="#{bundle.CreateTaskTitle_durationPerMonth}" />
<p:outputLabel value="#{bundle.CreateTaskLabel_startDate}"
for="startDate" />
<p:calendar id="startDate"
value="#{ViewLfmJpaController.newTaskDTO.startDate}"
title="#{bundle.CreateTaskTitle_startDate}" pattern="d MMM yyyy"
effect="fold">
<f:convertDateTime pattern="d MMM yyyy" />
</p:calendar>
<p:outputLabel value="#{bundle.CreateTaskLabel_endDate}"
for="endDate" />
<p:calendar id="endDate"
value="#{ViewLfmJpaController.newTaskDTO.endDate}"
title="#{bundle.CreateTaskTitle_endDate}" pattern="d MMM yyyy"
effect="fold">
<f:convertDateTime pattern="d MMM yyyy" />
</p:calendar>
<f:facet name="footer">
<p:commandButton value="Add"
actionListener="#{ViewLfmJpaController.addTask}" update="Matrix"
oncomplete="PF('dlg').hide()" />
</f:facet>
</h:panelGrid>
</h:form>
</p:dialog>
<p:dataTable id="Matrix" resizableColumns="true" scrollable="true"
scrollHeight="80%"
value="#{ViewLfmJpaController.selected.tasksDtoCollection}"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {Exporters}"
var="item" resizeMode="expand" paginator="true" rows="10"
style="margin-bottom:20px">
<f:facet name="header">
Logical Framewrok Matrix
</f:facet>
<f:facet name="{Exporters}">
<p:commandLink>
<p:graphicImage name="../resources/images/pdf.jpg" width="24" />
<p:dataExporter type="pdf" target="Matrix" fileName="lfm" />
</p:commandLink>
</f:facet>
<p:column headerText="Index" colspan="1">
<c:forEach var="i" begin="1" end="#{ViewLfmJpaController.listSize}">
<p:outputLabel value="#{i}"></p:outputLabel>
</c:forEach>
</p:column>
<p:column headerText="Task Title">
<p:outputLabel value="#{item.name}"></p:outputLabel>
</p:column>
<p:column headerText="Start Date" colspan="3">
<p:outputLabel value="#{item.formatedStartDate}"></p:outputLabel>
</p:column>
<p:column headerText="End Date" colspan="3">
<p:outputLabel value="#{item.formatedEndDate}"></p:outputLabel>
</p:column>
<c:forEach var="i" begin="1"
end="#{ViewLfmJpaController.numberOfMonths}">
<p:column headerText="m ${i}" colspan="1"></p:column>
</c:forEach>
<p:column headerText="Exptected Outcomes" colspan="4">
<ui:repeat value="#{item.tasksExpectedOutcomesCollection}" var="teo">
<li><h:outputText value="#{teo.expectation}">
</h:outputText></li>
</ui:repeat>
</p:column>
</p:dataTable>
<p:commandButton value="Add Task" oncomplete="PF('dlg').show()"></p:commandButton>
</ui:define>
</ui:composition>
I FOUND THE SOLUTION BY MYSELF.
First : You have to know that you cannot make nested forms in your page.
Second : you have to know that to submit <p:dialog> </p:dialog> or to use <h:commandLink> </h:commandLink> you need to use form.
So I had removed the form in the dialog component and add a general component contains dialog and dataTable together

ColumnModel Set Header error with mono 3.3.0

This is my asp.net GridPanel code with columnmodel id ColumnModel3
<South Split="true" Collapsible="true" CollapseMode="Mini">
<ext:Panel runat="server" ID="pnlMsgLst" Frame="true" Height="145" Title="消息列表" AutoScroll="true"
Collapsed="true">
<Content>
<ext:GridPanel ID="vehGridPnl" runat="server" StoreID="msgStore" StripeRows="true"
Frame="true" AutoHeight="true" AutoExpandColumn="Id" AutoScroll="true" EnableHdMenu="false">
<ColumnModel ID="ColumnModel3" runat="server">
<Columns>
<ext:Column ColumnID="Id" Header="ID" Width="80" DataIndex="Id" Hidden="false" />
<ext:Column Header="消息内容" Width="180" DataIndex="Content">
<Renderer Fn="change" />
</ext:Column>
<ext:Column Header="车牌号码" Width="90" DataIndex="CarPlateNo">
<Renderer Fn="change" />
</ext:Column>
<ext:Column Header="设备ID" Width="90" DataIndex="DevID">
<Renderer Fn="change" />
</ext:Column>
<ext:Column Header="经度" Width="80" DataIndex="Longitude">
<Renderer Fn="change" />
</ext:Column>
<ext:Column Header="纬度" Width="80" DataIndex="Latitude">
<Renderer Fn="change" />
</ext:Column>
<ext:Column Header="速度" Width="70" DataIndex="Speed">
<Renderer Fn="change" />
</ext:Column>
<ext:Column Header="方向" Width="70" DataIndex="Angle">
<Renderer Fn="change" />
</ext:Column>
<ext:Column Header="定位" Width="80" DataIndex="Location">
<Renderer Fn="change" />
</ext:Column>
<ext:Column Header="时间" Width="150" DataIndex="Date">
<Renderer Fn="change" />
</ext:Column>
<ext:Column Header="车辆状态" Width="300" DataIndex="Status">
<Renderer Fn="change" />
</ext:Column>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel3" SingleSelect="true" runat="server">
</ext:RowSelectionModel>
</SelectionModel>
</ext:GridPanel>
</Content>
</ext:Panel>
</South>
this is a Javascript, when page loaded, will automatically run this function
function ChangeTitle() {
vehListPanel.setTitle(VehList_Title + " :" + nVehCount.toString());
btnVehDetails.setText(vVehDetails);
pnlMsgLst.setTitle(pMsgList);
ColumnModel3.setColumnHeader(1, pContent);
ColumnModel3.setColumnHeader(2, vVehNum);
ColumnModel3.setColumnHeader(3, vDevID);
ColumnModel3.setColumnHeader(4, pLongitude);
ColumnModel3.setColumnHeader(5, pLatitude);
ColumnModel3.setColumnHeader(6, pSpeed);
ColumnModel3.setColumnHeader(7, pAngle);
ColumnModel3.setColumnHeader(8, pLocate);
ColumnModel3.setColumnHeader(9, pTime);
ColumnModel3.setColumnHeader(10, pAlarmStatus);
}
This Function will change the columnmodel3 header.
Unfortunately, this only work on IIS, when i m trying on my real server, it will return an Error
ReferenceError: ColumnModel3 is not defined
ColumnModel3.setColumnHeader(1, pContent);
is this a bug? or what? any other way to change the column header ?
Server are using mono3.3.0,xsp4 and ext.net version is 1.3.0
P/S : other components like button,label are working proper with SetText and SetTitle. just ColumnModel having the problem.
Since, the way can't work, i m trying on firebug to change the header, and finally i get the way to change the header from firebug with javascript like this
vehColModel = parent.frames["StatisticFrm0_IFrame"].vehGrid.colModel
vehColModel.setColumnHeader(3, vVehNum);
vehColModel.setColumnHeader(4, vDevID);

iterator over display tag column in struts?

Hi friends i have developed an application of PhotoAlbum, in show photo jsp the page shows all user information along with their uploaded image names. the output it displays on jsp is similar to the below format.
==========================================================================
| NAME | FatherName |AGE|ADDRESS | PhotoList |
==========================================================================
|nathjo r | FATHERNAME |12 | XYZ |[asasdd, asada, asada, aasasada] |
|SRT | ERNAME |12 | XYZ |[1212, 1212, 1212] |
|SRY | ERNAME |12 | XYZ |[bb, ccas, asdda, da, qwqda, qwqda, qwqda] |
==========================================================================
as you can see it is perfect, the last column[PhotoList] is a list of strings. so my question is i want to do iteration [put logical iterator tag] on the last column to do additional operation depending on the number of element present in the last column along with displaying image names. so what i thought is like this i know it is wrong any suggestion to do it like that.
<display:table id="data" name="sessionScope.UserForm.userList" requestURI="/userAction.do" pagesize="3" >
<display:column property="name" title="NAME" sortable="true" />
<display:column property="fatherName" title="User Name" sortable="true" />
<display:column property="age" title="AGE" sortable="true" />
<display:column property="address" title="ADDRESS" sortable="true" />
<logic:iterate property="photolist" id="photoId" indexId="index">
***here i want to display the image name***
</logic:iterate>
</display:table>
Thanks in Advance
Lets have iterate tag inside the <display:column> tag something like this
<display:table id="data" name="sessionScope.UserForm.userList" requestURI="/userAction.do" pagesize="3" >
<display:column property="name" title="NAME" sortable="true" />
<display:column property="fatherName" title="User Name" sortable="true" />
<display:column property="age" title="AGE" sortable="true" />
<display:column property="address" title="ADDRESS" sortable="true" />
<display:column title="Photo List">
<logic:iterate property="photolist" id="photoId" indexId="index">
<s:property />,
</logic:iterate>
</display:column>
</display:table>

Error with automatic delete when RadGrid is bound to EntityDataSource

I have a RadGrid that's bound to EntityDataSource. A few of the columns are bound to navigation properties of the bound entity. When I try to delete a record, it gives the following error:
Error: Sys.WebForms.PageRequestManagerServerErrorException: A property named 'Vehicle.VehicleNo' was not found on the entity during an insert, update, or delete operation. Check to ensure that properties specified as binding expressions are available to the data source.
I know if I choose to use the plain foreign key IDs, instead of the navigation properties, everything works. I can easily get the delete to work if I handle it manually. But I"m just thinking there's got to be a way for the automatic delete to work too. Any ideas?
<telerik:RadGrid ID="RadGrid1" runat="server" AllowAutomaticDeletes="True"
AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
DataSourceID="EntityDataSource1" GridLines="None" ShowGroupPanel="True" Skin="Hay"
OnItemUpdated="RadGrid1_ItemUpdated"
OnItemInserted="RadGrid1_ItemInserted" OnItemCommand="RadGrid1_ItemCommand"
Height="400px" Width="700px" CellSpacing="0">
<MasterTableView DataKeyNames="ADChecklistId" DataSourceID="EntityDataSource1" CommandItemDisplay="Top">
<CommandItemSettings AddNewRecordText="Add New Aerial Device Checklist" ShowRefreshButton="false"
ShowAddNewRecordButton="true"></CommandItemSettings>
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn"
HeaderText="Edit">
</telerik:GridEditCommandColumn>
<telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" UniqueName="DeleteCommandColumn" HeaderText="Delete" ConfirmDialogType="RadWindow" ConfirmText="Are you sure you want to delete this record?">
</telerik:GridButtonColumn>
<telerik:GridBoundColumn DataField="Vehicle.VehicleNo" FilterControlAltText="Filter VehicleNo column"
HeaderText="VehicleNo" SortExpression="Vehicle.VehicleNo" UniqueName="Vehicle.VehicleNo">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Employee.FirstName" FilterControlAltText="Filter FirstName column"
HeaderText="FirstName" SortExpression="Employee.FirstName" UniqueName="Employee.FirstName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Employee.LastName" FilterControlAltText="Filter LastName column"
HeaderText="LastName" SortExpression="Employee.LastName" UniqueName="Employee.LastName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Utility.UtilityName" HeaderText="Utility" SortExpression="Utility.UtilityName" UniqueName="Utility.UtilityName" >
</telerik:GridBoundColumn>
<telerik:GridDateTimeColumn DataField="CreatedOn" DataType="System.DateTime" FilterControlAltText="Filter CreatedOn column"
HeaderText="CreatedOn" SortExpression="CreatedOn" UniqueName="CreatedOn" DataFormatString="{0:MM/dd/yy}">
</telerik:GridDateTimeColumn>
<telerik:GridBoundColumn DataField="CreatedBy" FilterControlAltText="Filter CreatedBy column"
HeaderText="CreatedBy" SortExpression="CreatedBy" UniqueName="CreatedBy">
</telerik:GridBoundColumn>
<telerik:GridDateTimeColumn DataField="ModifiedOn" DataType="System.DateTime" FilterControlAltText="Filter ModifiedOn column"
HeaderText="ModifiedOn" SortExpression="ModifiedOn" UniqueName="ModifiedOn" DataFormatString="{0:MM/dd/yy}">
</telerik:GridDateTimeColumn>
<telerik:GridBoundColumn DataField="ModifiedBy" FilterControlAltText="Filter ModifiedBy column"
HeaderText="ModifiedBy" SortExpression="ModifiedBy" UniqueName="ModifiedBy">
</telerik:GridBoundColumn>
</Columns>
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column">
</EditColumn>
</EditFormSettings>
</MasterTableView>
<ClientSettings AllowDragToGroup="True" EnablePostBackOnRowClick="true">
<Scrolling AllowScroll="True" UseStaticHeaders="True" />
<Resizing AllowColumnResize="true" ClipCellContentOnResize="false" />
</ClientSettings>
<FilterMenu EnableImageSprites="False">
</FilterMenu>
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
</HeaderContextMenu>
</telerik:RadGrid>
<asp:EntityDataSource ID="EntityDataSource1" runat="server" AutoGenerateWhereClause="True"
ConnectionString="name=MSOpsEntities" DefaultContainerName="MSOpsEntities"
EnableFlattening="False" EnableDelete="True" EntitySetName="ADChecklists"
Include="Vehicle, Employee, Utility" OrderBy="it.CreatedOn DESC"
OnSelecting="EntityDataSource1_Selecting"
ondeleting="EntityDataSource1_Deleting">
<WhereParameters>
<asp:SessionParameter Name="UtilityId" SessionField="utilityId" Type="Int32" />
</WhereParameters>
</asp:EntityDataSource>
Try setting ReadOnly="true" on the GridBoundColumns containing the navigation properties, this worked for me. Maybe also you could use template columns with Eval rather than Bind