Win a copy of Practice Tests for OCP Java 17 Certification Exam (1Z0-829) this week in the OCPJP forum!

Pushpalatha Gowdra

Greenhorn
+ Follow
since Jan 25, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Pushpalatha Gowdra

Hi Kiran Kumar,

Even I am facing the same problem. Did you get any solution this problem?

Regards,
Pushpa
12 years ago
JSF
Hello Bart,

I have the code as below, and column is not getting refreshed. If I put the tr:poll tag inside a column then, it refreshes only the 1st column.
Could you please help me.

<tr:form id="table">
<tr:subform id="subformPoll">
<tr:poll id="poll" interval="2000" pollListener="#{report2.incrementVisits}" ></tr:poll>
</tr:subform>

<tr:table id="EquipmentReport" var="page" value="#{report2.dataModel}" rows="3" rowBandingInterval="1" emptyText="Sorry! no records found" horizontalGridVisible="true" verticalGridVisible="true" >

<tr:column headerText="Webpage Name" styleClass="headerClass">
<tr:outputText value="#{page.name}" styleClass="outputText"/>
</tr:column>

<tr:column headerText="URL" styleClass="headerClass">
<tr:outputText value="#{page.url}" styleClass="outputText" />
</tr:column>

<tr:column id="result" headerText="Number of Visits" styleClass="headerClass" partialTriggers=":subformPoll:poll">
<tr:outputText id="status" partialTriggers=":subformPoll:poll" value="#{page.numVisits}" styleClass="outputText" />
</tr:column>

</tr:table>

</tr:form>

Regards,
Pushpa
12 years ago
JSF
Hi Bart,

I think the partial trigger happens because of the partialTrigger attribute present in tr:table, not because of the partialTrigger attribute present in tr:inputText.

Can we achieve this without actually refreshing the complete table?

Regards,
Pushpa
12 years ago
JSF
Hi Sree javab ,

I have a similar problem. Are you able to refresh a single column of table using PPR?

Regards,
Pushpa
12 years ago
JSF
Hello,

I have a datatable with a column as status and I would like to refresh only that column for every 5 seconds. I have tried partialTriggers attribute and also addPartialTarget(). But its not working for me.

I am using trinidad-1.0.12 and myfaces-1.1.7.

Any help would be appriciated

Regards,
Pushpa
12 years ago
JSF
In continuation to my prevous mail, I am using
myfaces-api-1.1.7.jar
myfaces-impl-1.1.7.jar
trinidad-api-1.0.12.jar
trinidad-impl-1.0.12.jar

Regards,
Pushpa
12 years ago
JSF
Hello,

I have a .jspx file with following code

<?xml version="1.0" encoding="ISO-8859-1" ?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:trh="http://myfaces.apache.org/trinidad/html"
xmlns:tr="http://myfaces.apache.org/trinidad" >

<jsp:directive.page language="java"
contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" />

<f:view>
<tr:document id="ppr">
<tr:form id="frm1">
<tr:subform id="subfrm1">
<tr:commandButton text="Do Something" id="myButton" partialSubmit="true" actionListener="#{myBean.doSomething}"/>

<!-- repaint the outputText any time 'myButton' has an event -->
<tr:outputText id="pprrecv" value="#{myBean.textValue}" partialTriggers="myButton"/>
</tr:subform>
</tr:form>
</tr:document>
</f:view>
</jsp:root>

When I check the debug messages, partial trigger is happening, but I am not able to see the changes in UI. The component is not getting repainted. I am struggling to use PPR functionality of trinidad. Any help would be appriciated.


Thanks in advance

Regards,
Pushpa
12 years ago
JSF
The problem resolved

The problem was in my getter method

public DataModel getUserModel() {
if(userModel == null)
userModel = new ListDataModel();
userModel.setWrappedData(search.getUsersList());

return userModel;
}

this method was setting the wrapper everytime we call the method getUserModel.

To make it work properly, I should write the method in the same class where getUserModel() is there, which will give me the getRowData() directly.
something like:

public Object getSelectedData() {
return userModel.getRowData();
}


And I shouldn't call getUserModel() to get the current model used by the dataTable in the backing bean. It should be used only in the jsf file, to construct the table.

Regards,
Pushpa
14 years ago
JSF
Hi,

I have a table with user data in ListDataModel called "userModel" with a getter method

public DataModel getUserModel() {
if(userModel == null)
userModel = new ListDataModel();
userModel.setWrappedData(search.getUsersList());

return userModel;
}

the jsp file using this table is :

<h:dataTable styleClass="table.data" rowClasses="evenRow, oddRow" headerClass="columnHeader" value="#{handleTable.userModel}" var="result" >
<h:column>
<f:facet name="header">
<h:outputText value="#{labels.empId}"/>
</f:facet>
<h:commandLink action="#{navigate.updateUser}" immediate="true">
<h:outputText value="#{result.empId}"/>
</h:commandLink>
</h:column>

and the action method linked with command link is:

public String updateUser(){

HttpSession session= (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
DataModel userModel = ((DataTableHandler) session.getAttribute("handleTable")).getUserModel();

/*System.out.println("selected row: " + userModel.getRowIndex());
System.out.println("row available: " + userModel.isRowAvailable());*/

session.removeAttribute("user");
session.setAttribute("user",userModel.getRowData());

forUpdate = true;
return "updateUser";
}

But whats happening is, the userModel.getRowIndex() method is always returning zero "0", and hence the userModel.getRowData() method is always returning first row object.

Do I need to set the rowIndex manually?

Any help would be appriciated. Thanks in advance

Regards,
Pushpa
14 years ago
JSF
Hi,

I am trying to add a command link to a dynamic dataTable. to achieve this I have written the code as below:

Application application = context.getApplication();
UICommand out = (UICommand) application.createComponent("javax.faces.HtmlCommandLink");

UIOutput output = new UIOutput();
ValueBinding vb = context.getApplication().createValueBinding("#{user." + cols[i] + "}");
output.setValueBinding("value", vb);

out.getChildren().add(output);

MethodBinding mb = application.createMethodBinding("#{navigate.updateUser}", new Class[0]);
out.setAction(mb);

out.setImmediate(true);

col.getChildren().add(out);

Here user & navigate are backing beans.

The table is rendered and the column with command link shows the link, but on click of that link the same page is getting reloaded instead of calling the action set for the command link.

Some one please help me and let me know what's wrong in the above code. Is there any other way to achieve the above requirement.

Thanks in advance.

Regards,
Pushpa
14 years ago
JSF
Hi,

I am trying to add a command link to a dynamic dataTable. to achieve this I have written the code as below:

Application application = context.getApplication();
UICommand out = (UICommand) application.createComponent("javax.faces.HtmlCommandLink");

UIOutput output = new UIOutput();
ValueBinding vb = context.getApplication().createValueBinding("#{user." + cols[i] + "}");
output.setValueBinding("value", vb);

out.getChildren().add(output);

MethodBinding mb = application.createMethodBinding("#{navigate.updateUser}", new Class[0]);
out.setAction(mb);

out.setImmediate(true);

col.getChildren().add(out);

Here user & navigate are backing beans.

The table is rendered and the column with command link shows the link, but on click of that link the same page is getting reloaded instead of calling the action set for the command link.

Some one please help me and let me know what's wrong in the above code. Is there any other way to achieve the above requirement.

Thanks in advance.

Regards,
Pushpa
14 years ago
JSF
Hi,

I am trying to add a command link to a dynamic dataTable. to achieve this I have written the code as below:

Application application = context.getApplication();
UICommand out = (UICommand) application.createComponent("javax.faces.HtmlCommandLink");

UIOutput output = new UIOutput();
ValueBinding vb = context.getApplication().createValueBinding("#{user." + cols[i] + "}");
output.setValueBinding("value", vb);

out.getChildren().add(output);

MethodBinding mb = application.createMethodBinding("#{navigate.updateUser}", new Class[0]);
out.setAction(mb);

out.setImmediate(true);

col.getChildren().add(out);

Here user & navigate are backing beans.

The table is rendered and the column with command link shows the link, but on click of that link the same page is getting reloaded instead of calling the action set for the command link.

Some one please help me and let me know what's wrong in the above code. Is there any other way to achieve the above requirement.

Thanks in advance.

Regards,
Pushpa
14 years ago
JSF
Let me explain my problem in detail,

I have 2 command components in the form a selectBooleanCheckbox and a commandButton.

On submit from commandButton all fields should be validated, model values should be updated and response should be rendered. I mean it should follow complete request processing life cycle.

On click of selectBooleanCheckbox only the model values should be updated & the page should be reloaded (rendered again) to display the user entered values. Some fields are set to rendered=false if selectBooleanCheckbox is checked.

I have set immediate=true for selectBooleanCheckbox and calling form.submit on onclick event of selectBooleanCheckbox

so only for submit from selectBooleanCheckbox the validation should be skipped. please let me know how this can be achieved

Regards,
Pushpa
14 years ago
JSF
Thanks for your kind help.

I tried both options.

Option1:
window.location = window.location;
This is taking me to my first page, and not refreshing the current page, as at that time the URL was not set to current page.

Option2:
form.submit() is working fine, but its doing some mandatory field validation, which should be skipped for page refresh.

Is there any way to submit the form by skiping the validation?

Regards,
Pushpa
14 years ago
JSF
[Resolved - for time being]

Hi,

There is a round around solution to the problem. set a default style for select in the included .css and apply the required style on <h:selectOneMenu> component. So far its working fine

Regards,
Pushpa
14 years ago
JSF