How to pass the User entity results from action class to view.jsp - jstl

I have created a portlet where I am fetching the user details filtering the list based on some condition in my action class. Now how can I pass the results (List of users) from my action class to view.jsp?
my Action class code,
public void addEntry(ActionRequest request, ActionResponse response) throws PortalException, SystemException
{
int usersCount = UserLocalServiceUtil.getUsersCount();
List<User> usersList = UserLocalServiceUtil.getUsers(0 , usersCount);
System.out.println("List Size is ===>"+ usersList);
if (usersList != null) {
for (User user : usersList) {
if(user.getFacebookId() == 12345 && user.getStatus() == 0)
{
System.out.println(((Long) user.getUserId()).toString()+ "," + user.getFullName()+ "," + user.getFirstName()+ "," + user.getLastName()+ "," + user.getScreenName());
}
}
}
}
In my action class I am filtering the list based on FacebookID and user status. It is printing the required users list. Now How can I send the list of filtered users to my view page.
View page code,
<liferay-ui:search-container delta="10" emptyResultsMessage="no-users-were-found">
<liferay-ui:search-container-results
results="<%=UserLocalServiceUtil.getUsers(searchContainer.getStart(), searchContainer.getEnd())%>"
total="<%=UserLocalServiceUtil.getUsersCount()%>" />
<liferay-ui:search-container-row
className="com.liferay.portal.model.User"
keyProperty="userId"
modelVar="user"
>
<liferay-ui:search-container-column-text
name="name"
value="<%= user.getFullName() %>"
/>
<liferay-ui:search-container-column-text
name="first-name"
property="firstName"
/>
<liferay-ui:search-container-column-text
name="last-name"
property="lastName"
/>
<liferay-ui:search-container-column-text
name="screen-name"
property="screenName"
/>
</liferay-ui:search-container-row>
<liferay-ui:search-iterator />
</liferay-ui:search-container>
<liferay-ui:search-container delta="10" emptyResultsMessage="no-users-were-found" />
Any suggestions that How can I pass the filter list in action class to liferay-ui:search-container-results.
Thanks in advance.

List<User> tempList = new ArrayList<User>();
for (User user : usersList) {
if(user.getFacebookId() == 12345 && user.getStatus() == 0)
{
tempList.add(user);
System.out.println(((Long) user.getUserId()).toString()+ "," + user.getFullName()+ "," + user.getFirstName()+ "," + user.getLastName()+ "," + user.getScreenName());
}
}
actionRequest.setAttribute("userList",tempList);
Put up the usersList in the request object from the Action Class by using actionRequest.setAttribute("userList",tempList); And also the user count in the same fashion. Now in the jsp just replace the following lines.
results="<%=request.getAttribute("userList")%>"
total="<%=request.getAttribute("count")%>
Not sure you may need some type casting also on the above lines.

Related

Passing parameter between views in MVC

I have an ASP.NET Core MVC web app. I have a searchString parameter in the Index method. When parameter is filled, I can see value on web link, for example ...?SearchString=202.
I'd like to send this parameter to the second method (for example Edit), not to change it there and send back to the Index method after user press the Back button.
The idea is that when the user press the Back button, he returns to the Index view but he lost searchString parameter and the user does not have a filtered page according to the previous search.
If you want to pass the searchString in the path of Index-Edit-Index , you could use ViewBag and then pass it as the routevalue.Refer to the following is a simple working demo :
Index action, save the searchString in ViewBag.SearchString.
public async Task<IActionResult> Index(string searchString)
{
var movies = from m in _context.Movie
select m;
if (!String.IsNullOrEmpty(searchString))
{
movies = movies.Where(s => s.Title.Contains(searchString));
ViewBag.SearchString = searchString;
}
return View(await movies.ToListAsync());
}
Index View , add the routevalue returnString in the Edit link
<a asp-action="Edit" asp-route-id="#item.Id" asp-route-returnString="#ViewBag.SearchString">Edit</a>
Edit action
public async Task<IActionResult> Edit(int? id,string returnString = null)
{
if (id == null)
{
return NotFound();
}
var movie = await _context.Movie.FindAsync(id);
ViewBag.SearchString = returnString;
if (movie == null)
{
return NotFound();
}
return View(movie);
}
Edit View , Back link
<div>
#if (ViewBag.SearchString != null)
{
<a asp-action="Index" asp-route-searchString="#ViewBag.SearchString">Back to List</a>
}
else
{
<a asp-action="Index">Back to List</a>
}
</div>

add role to user RESTful [Spring-Rest]

I have to add a User one or multiple Role(s) in my Application. Currently i add one Role to a User at a time with this method:
UserController.java
#RequestMapping(value = "users/{id}/{roleId}", method = RequestMethod.POST)
public User assignRole(#PathVariable Long id, #PathVariable Long roleId) throws NotFoundException {
log.info("Invoked method: assignRole with User-ID: " + id + " and Role-ID: " + roleId);
User existingUser = userRepository.findOne(id);
if(existingUser == null){
log.error("Unexpected error, User with ID " + id + " not found");
throw new NotFoundException("User with ID " + id + " not found");
}
Role existingRole = roleRepository.findOne(roleId);
if(existingRole == null) {
log.error("Unexpected error, Role with ID " + id + " not found");
throw new NotFoundException("Role with ID " + id + " not found");
}
Set<Role> roles = existingUser.getRoles();
roles.add(existingRole);
existingUser.setRoles(roles);
userRepository.saveAndFlush(existingUser);
log.info("User assigned. Sending request back. ID of user is " + id + existingUser.getRoles());
return existingUser;
}
This Method works fine but the problem is:
The method can only add one Role to one User at a time
The method is not RESTful
My Question is:
How can i add one or multiple Roles to a User in the concept of REST ?
Should i even have a specific method to add roles to a user? or should i add the roles to the user in my update-method via PUT?
I found this as a valid proposal:
#RequestMapping(value="/test/{firstNameIds}", method=RequestMethod.GET)
#ResponseBody
public String test(#PathVariable List<Integer> firstNameIds) {
//Example: pring your params
for(Integer param : firstNameIds) {
System.out.println("id: " + param);
}
return "Dummy";
}
what corresponds to a URL like that: GET http://localhost:8080/public/test/1,2,3,4
Insteaf of Integer Long should also work.
POST or PUT? .. None of them I would say. PATCH is the right one to use since you are not creating a new object/entity and you are not updating a whole object. Instead you update only one field of a object (see here: https://spring.io/understanding/REST). Your PATCH-call is also idempotent, what means that the same call done repeatedly always returns the same result.
If you want to use a parameter for roleIds in your request (would fit better to the "Update only the specified fields of an entity at a URI." requirement of PATCH) it should look like this:
#RequestMapping(value="users/{id}", method = RequestMethod.PATCH)
public void action(#PathVariable Long id, #RequestParam(value = "param[]") String[] roleIds) {
...
}
You must try out with List<Long>.
The corresponding client call (in jQuery) looks like:
$.ajax({
type: "PATCH",
data: { param:roleIds }
...
});

Populating Umbraco Contour forms from using cookie data

We're currently using Umbraco version 7.1.4 assembly: 1.0.5261.28127 with Contour version 3.0.26
I'm trying to populate a contour form with information pulled from a database, but dependent on a user cookie (the cookie hold the primary key for the record in the database).
To implement this I'm looking at writing a custom field type (well a bunch of them, one for each data field) which examines the cookie makes the db request and then populates the textbox with the value (users name/address/etc).
I've managed to add custom setting to a control and have it display the value that's populated at design time, but I can't seem to amend that value at run time.
I'm happy to post the code if relevant, but my question is. Am I barking up the wrong tree? is this the best way to handle this or would it even work?
Any pointers would be most welcome
Thanks
EDIT
Thanks Tim,
I've now managed to break it in such a way it's not even rendering the controls (the debug message is saying the SVT value doesn't exist).
This just (or should) just populate the form with the current date/time just to get something working.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Umbraco.Forms.Core;
using System.Web.UI.WebControls;
namespace Custom.FieldType
{
public class CustomTextfield : Umbraco.Forms.Core.FieldType
{
public CustomTextfield()
{
//Provider
this.Id = new Guid("b994bc8b-2c65-461d-bfba-43c4b3bd2915");
this.Name = "Custom Textfield";
this.Description = "Renders a html input fieldKey"; //FieldType
this.Icon = "textfield.png";
this.SVT = DateTime.Now.ToLongTimeString();
}
public System.Web.UI.WebControls.TextBox tb;
public List<Object> _value;
[Umbraco.Forms.Core.Attributes.Setting("SVT", description = "the SVT")]
public string SVT { get; set; }
public override WebControl Editor
{
get
{
tb.TextMode = System.Web.UI.WebControls.TextBoxMode.SingleLine;
tb.CssClass = "text gaudete";
if (_value.Count > 0)
tb.Text = _value[0].ToString();
SVT = DateTime.Now.ToLongTimeString();
tb.Text = tb.Text + SVT;
return tb;
}
set { base.Editor = value; }
}
public override List<Object> Values
{
get
{
if (tb.Text != "")
{
_value.Clear();
_value.Add(tb.Text);
}
return _value;
}
set { _value = value; }
}
public override string RenderPreview()
{
return
"<input type=\"text\" id=\"text-content\" class=\"text\" maxlength=\"500\" value=\"" + this.SVT + "\" />";
}
public override string RenderPreviewWithPrevalues(List<object> prevalues)
{
return RenderPreview();
}
public override bool SupportsRegex
{
get { return true; }
}
}
}
And the view is
#model Umbraco.Forms.Mvc.Models.FieldViewModel
#{
var widthSetting = Model.AdditionalSettings.FirstOrDefault(s => s.Key.Equals("Width"));
string width = (widthSetting == null) ? null : widthSetting.Value;
var textSetting = Model.AdditionalSettings.FirstOrDefault(s => s.Key.Equals("SVT"));
string widthTXT = (textSetting == null) ? null : textSetting.Value;
}
<input type="text" name="#Model.Name" id="#Model.Id" class="text" maxlength="500"
value="#{if(!string.IsNullOrEmpty(widthTXT)){<text>#(SVT)</text>}}"
#{if(Model.Mandatory || Model.Validate){<text>data-val="true"</text>}}
#{if (Model.Mandatory) {<text> data-val-required="#Model.RequiredErrorMessage"</text>}}
#{if (Model.Validate) {<text> data-val-regex="#Model.InvalidErrorMessage" data-regex="#Model.Regex"</text>}}
/>
The code is mostly cobbled together from online tutorials which is why the naming is abysmal but if I can get something to populate the text box on the clients side then I can start the process of refactoring (well scrapping this demo version and writing a real version)
Thanks.
EDIT2
I was able to fix the error stopping the view loading thanks to the pointer from Tim, the new view looks as follows
#model Umbraco.Forms.Mvc.Models.FieldViewModel
#{
var textSetting = Model.AdditionalSettings.FirstOrDefault(s => s.Key.Equals("SVT"));
string widthTXT = (textSetting == null) ? null : textSetting.Value;
}
<input type="text" name="#Model.Name" id="#Model.Id" class="text" maxlength="500"
value="#{if(!string.IsNullOrEmpty(widthTXT)){<text>#(widthTXT)</text>}else{<text>Unknown</text>}}"
#{if(Model.Mandatory || Model.Validate){<text>data-val="true"</text>}}
#{if (Model.Mandatory) {<text> data-val-required="#Model.RequiredErrorMessage"</text>}}
#{if (Model.Validate) {<text> data-val-regex="#Model.InvalidErrorMessage" data-regex="#Model.Regex"</text>}}
/>
And just displays "Unknown" in the text box
thanks again.

How method calls?

At the moment i am developing GUI on JavaFX 2, and i`ve found good oracle sample: FXML-LoginDemo. In this sample 2 scenes(FXML based), 1st is AuthoriseForm, 2nd is UserData changing, Main class has the next method:
public boolean userLogging(String userId, String password){
if (Authenticator.validate(userId, password)) {
loggedUser = User.of(userId);
gotoProfile();
return true;
} else {
return false;
}
}
gotoProfile(); - changing scene..
LoginController class has the next method:
public void processLogin(ActionEvent event) {
if (application == null){
// We are running in isolated FXML, possibly in Scene Builder.
// NO-OP.
errorMessage.setText("Hello " + userId.getText());
} else {
if (!application.userLogging(userId.getText(), password.getText())){
errorMessage.setText("Username/Password is incorrect");
}
}
}
processLogin() has no calls in the code.. So the question is: How processLogin() calls after pressing
#FXML
Button login;
Here is a link to the Login.fxml file.
That file contains this line:
<Button id="button1" fx:id="login" defaultButton="true" onAction="#processLogin" prefHeight="70.0" prefWidth="400.0" text="Login" AnchorPane.bottomAnchor="66.0" AnchorPane.leftAnchor="40.0" AnchorPane.rightAnchor="40.0" />
That line sets this attribute:
onAction="#processLogin"
That attribute says that the button click (ActionEvent) should be handled by a method defined in the controller.

p:datatable loses sort column and order after ajax refresh

I have a button on a page that causes my data table to refresh via an AJAX request. Something like this:
<h:form id="datatable">
<p:dataTable/>
</h:form>
<p:commandButton update=":datatable">
This is all fine an dandy except that when the table is refreshed it reverts to not sorting anything while still showing that it's sorting based on the previous value. In other words, the header is still highlighted and the arrow is still pointing in the sort direction but no sort is actually being performed. Obviously this isn't ideal.
Ideally I'd like the component to keep it's sort order in the view state and then submit the proper parameters during the AJAX request (so that the sort is correctly defined). Am I missing a parameter or something? Does anyone else have this issue?
From what I can tell when the table is expecting a sort back it posts the following options:
<componentID>_sortDir
<componentID>_sortKey
<componentID>_sorting
<componentID>_updateBody
When I refresh the form this doesn't happen. It also doesn't happen if I just refresh the table (thought I could work around things by updating the component directly). Is there a way to get the table to refresh correctly?
I wrote an extension to #truemmer's solution. His reverts the sorting order back to the default, where as mine will reverts to the previous sort the user selected.
function postAjaxSortTable(datatable)
{
var selectedColumn = datatable.jq.find('.ui-state-active');
if(selectedColumn.length <= 0)
{
return;
}
var sortorder = "ASCENDING";
if(selectedColumn.find('.ui-icon-triangle-1-s').length > 0)
{
sortorder = "DESCENDING";
}
datatable.sort(selectedColumn, sortorder);
}
Updating the same table as truemmer's works like this:
<p:commandButton value="refresh" action="#{tableController.refreshPrices}" update="myTable" oncomplete="postAjaxSortTable(myTableWidget)" />
EDIT: Primefaces 4.0 MultiSort support
function postAjaxSortTable(datatable) {
var selectedColumn = undefined;
// multisort support
if(datatable && datatable.cfg.multiSort) {
if(datatable.sortMeta.length > 0) {
var lastSort = datatable.sortMeta[datatable.sortMeta.length-1];
selectedColumn = $(document.getElementById(lastSort.col));
}
} else {
selectedColumn = datatable.jq.find('.ui-state-active');
}
// no sorting selected -> quit
if(!selectedColumn || selectedColumn.length <= 0) {
return;
}
var sortorder = selectedColumn.data('sortorder')||"DESCENDING";
datatable.sort(selectedColumn, sortorder, datatable.cfg.multiSort);
}
First of all, there is an open ticket on the PrimeFaces Issue Tracker, which targets this question but was recently labeled as "won't fix".
Nevertheless, I found a nice workaround. The sorting of PrimeFaces tables can be triggered by calling an undocumented JavaScript method on the datatable's widget. The following might not work for future releases of PrimeFaces, but it does for 3.4.2:
Just add the following to your component, which triggers the update:
oncomplete="myTableWidget.sort($(PrimeFaces.escapeClientId('#{p:component('sortColumnId')}')), 'ASCENDING')"
The table might look like this:
<p:dataTable id="myTable"
widgetVar="myTableWidget"
value="#{myArticles}"
var="article"
sortBy="#{article.price}"
sortOrder="ASCENDING">
...
<p:column id="price" sortBy="#{article.price}">
<f:facet name="header">
<h:outputText value="Price" />
</f:facet>
<h:outputText value="#{article.price}" />
</p:column>
</p:dataTable>
So updating the table could work like this.
<p:commandButton value="refresh" action="#{tableController.refreshPrices}" update="myTable" oncomplete="myTableWidget.sort($(PrimeFaces.escapeClientId('#{p:component('price')}')), 'ASCENDING')" />
EDIT:
Solution posted below (LazyTable) works for the p:dataTable backed with LazyDataModel. Overriden load method is called after every update/refresh on the desired table and it handles sort properly. The problem with simple p:dataTable is that it performs predefined sort only on the first load, or after the click on sort column. This is a normal behaviour of a simple table.
So what are your possibilities for simple table :
Don't sort the table after update, but remove the sort column so end user is not missinformed. Add this to your action listener or action method for your update button :
UIComponent table = FacesContext.getCurrentInstance().getViewRoot().findComponent(":dataTablesForm:dataTableId");
table.setValueExpression("sortBy", null);
Update the sort of the table manually by script. This is not the best solution, but primefaces doesn't provide any client side function for "resorting" the table.
Basically you know that only one column at a time can be sorted and this column has a .ui-state-active. You can use it in a script and trigger 2 clicks on that column (1. click - other sort order, 2. click - back to current sort order).
<h:form id="mainForm">
<div id="tableDiv">
<p:dataTable id="dataTable" var="item" value="#{testBean.dummyItems}">
.
.
.
</p:dataTable>
<p:commandButton value="Refresh" oncomplete="refreshSort();" update=":mainForm:dataTable"/>
</div>
And script function :
function refreshSort(){
jQuery('#tableDiv').find('.ui-state-active').trigger('click');
jQuery('#tableDiv').find('.ui-state-active').trigger('click');
}
I know this is not the best workaround, but it works. You can use it as an inspiration to make something better.
LazyTable
IMHO the most proper way is to update directly the component you want. So for example :
<h:form id="dataTableForm">
<p:dataTable id="dataTableToUpdate">
.
.
.
</p:dataTable>
<p:commandButton value="Refresh" update=":dataTableForm:dataTableToUpdate" />
</h:form>
It should work fine in this scenario (I suppose it is your purpose) :
Open the .xhtml with your p:dataTable, sort some column (keep the facelet opened), update dataTables data from another .xhtml for example, click on refresh button. The dataTable should show your added value in correct (previously chosen) sort order - sorting was performed after update.
Hope it helped !
Add this PhaseListener to your application and both sorting and filtering will be kept after updating the DataTable.
public class DataTableUpdatePhaseListener implements PhaseListener {
private static final long serialVersionUID = 1L;
#Override
public void afterPhase(PhaseEvent event) {
// Nothing to do here
}
#Override
public void beforePhase(PhaseEvent event) {
FacesContext facesContext = event.getFacesContext();
if (!facesContext.isPostback()) {
return;
}
PartialViewContext partialViewContext = facesContext.getPartialViewContext();
if (partialViewContext != null) {
Collection<String> renderIds = partialViewContext.getRenderIds();
for (String renderId : renderIds) {
UIComponent component = facesContext.getViewRoot().findComponent(renderId);
if (component instanceof DataTable) {
DataTable table = (DataTable) component;
if (!table.isLazy()) {
updateDataTable(table);
}
}
}
}
}
#Override
public PhaseId getPhaseId() {
return PhaseId.RENDER_RESPONSE;
}
private void updateDataTable(DataTable table) {
FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext == null || table == null) {
return;
}
// Reapply filtering
if (!table.getFilters().isEmpty()) {
FilterFeature filterFeature = new FilterFeature();
filterFeature.decode(facesContext, table);
} else {
table.setFilteredValue(null);
}
// Reapply sorting
ValueExpression tableSortByVE = table.getValueExpression("sortBy");
if (tableSortByVE != null) {
String tableSortByExpression = tableSortByVE.getExpressionString();
// Loop on children, that are the columns, to find the one whose order must be applied.
for (UIComponent child : table.getChildren()) {
Column column = (Column) child;
ValueExpression columnSortByVe = column.getValueExpression("sortBy");
if (columnSortByVe != null) {
String columnSortByExpression = columnSortByVe.getExpressionString();
if (tableSortByExpression != null && tableSortByExpression.equals(columnSortByExpression)) {
// Now sort table content
SortFeature sortFeature = new SortFeature();
sortFeature.sort(facesContext, table, tableSortByVE,
SortOrder.valueOf(table.getSortOrder().toUpperCase(Locale.ENGLISH)),
table.getSortFunction());
break;
}
}
}
}
}
}
This is for non-lazy data tables. Data tables using a lazy model do not require this, as the lazy model will take care of sorting and filtering. For non-lazy data tables, this should work with both single and multiple column sorting but there is a bug in Primefaces that makes DataTable loose its MultiSortMeta between postbacks when updating the table. This means that the columns selected for sorting before postback are completely lost from FacesContext and component state and cannot be retrieved anymore upon postback. I'll look more into this later and provide an update if I manage to find a workaround or maybe Primefaces will fix it soon.
I implement a Comparator with my toString() method
municipios = municipioFacade.findAll();
Collections.sort(municipios, new DefaultComparator());
UIComponent table = FacesContext.getCurrentInstance().getViewRoot().findComponent(":municipios:municipios-tabla");
table.setValueExpression("sortBy", null);
comparator
public class DefaultComparator implements Comparator {
#Override
public int compare(Object o1, Object o2) {
return o1.toString().compareToIgnoreCase(o2.toString());
}
}
The solution is to have a conversational bean. In this case the p:dataTable refreshes the table and its entries without affecting the sort order. In the case when you have a p:commandButton on each line the table refresh works correctly too.
The conversational bean:
#Named
#Stateful
#ConversationScoped
public class ItemBean {
#Inject
private Conversation conversation;
private List<Item> items;
public List<Item> getItems() {
return this.items;
}
public void retrieve() {
// if it's an Ajax call then avoid retrieving items
if (FacesContext.getCurrentInstance().isPostback()) {
return;
}
// start a conversation
if (this.conversation.isTransient()) {
this.conversation.begin();
}
this.items = retrieveItems();
}
}
The associated page:
<f:metadata>
<f:event type="preRenderView" listener="#{itemBean.retrieve}" />
</f:metadata>
<h:form id="form">
<p:dataTable id="table" var="_item" value="#{testBean.items}">
... <!-- you can have the p:commandButton in a column too, to refresh the respective column only
<p:commandButton value="Refresh" action="#{itemBean.update(_item)}"
-->
</p:dataTable>
<p:commandButton value="Refresh" action="#{itemBean.update}" update=":form:table"/>
</h:form>
I had the same problem as you. I was able to fix the issue using a LazyDataModel. Because of the PrimeFaces issue with the row index, I needed to add the extra UtilitiesLazyDataModel(see row index comments):
public abstract class UtilitiesLazyDataModel <T> extends LazyDataModel<T>{
public UtilitiesLazyDataModel() {
}
#Override
public void setRowIndex(int rowIndex) {
/*
* The following is in ancestor (LazyDataModel):
* this.rowIndex = rowIndex == -1 ? rowIndex : (rowIndex % pageSize);
*/
if (rowIndex == -1 || getPageSize() == 0) {
super.setRowIndex(-1);
} else {
super.setRowIndex(rowIndex % getPageSize());
}
}
}
Then use your LazyDataModel class with this:
public class MyDataModel extends UtilitiesLazyDataModel<MyObjectClass>{
//override getRowData and getRowKey
}
#Rares Oltean's approach could also be implemented using preRenderView event listener.
On your jsf page register listener:
<f:event listener="#{managedBean.preRenderViewListener}" type="preRenderView" />
and implement it in a ManagedBean:
public void preRenderViewListener() {
FacesContext facesContext = FacesContext.getCurrentInstance();
if (!facesContext.isPostback()) {
return;
}
PartialViewContext partialViewContext = facesContext.getPartialViewContext();
if (partialViewContext != null) {
Collection<String> renderIds = partialViewContext.getRenderIds();
for (String renderId : renderIds) {
UIComponent component = facesContext.getViewRoot().findComponent(renderId);
if (component instanceof DataTable) {
DataTable table = (DataTable) component;
if (!table.isLazy()) {
updateDataTable(table);
}
}
}
}
}
private void updateDataTable(DataTable table) {
FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext == null || table == null) {
return;
}
if (!table.getFilters().isEmpty()) {
FilterFeature filterFeature = new FilterFeature();
filterFeature.decode(facesContext, table);
} else {
table.setFilteredValue(null);
}
ValueExpression tableSortByVE = table.getValueExpression("sortBy");
if (tableSortByVE != null) {
String tableSortByExpression = tableSortByVE.getExpressionString();
for (UIComponent child : table.getChildren()) {
Column column = (Column) child;
ValueExpression columnSortByVe = column.getValueExpression("sortBy");
if (columnSortByVe != null) {
String columnSortByExpression = columnSortByVe.getExpressionString();
if (tableSortByExpression != null && tableSortByExpression.equals(columnSortByExpression)) {
SortFeature sortFeature = new SortFeature();
sortFeature.sort(facesContext, table, tableSortByVE, table.getVar(),
SortOrder.valueOf(table.getSortOrder().toUpperCase(Locale.ENGLISH)),
table.getSortFunction());
break;
}
}
}
}
}

Resources