rajani varma

Ranch Hand
+ Follow
since Dec 21, 2006
Merit badge: grant badges
For More
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 rajani varma

Hello Saurabh,
I have no idea about <tr:tree>. Sorry..... :-(


Regards,
Rajani
16 years ago
JSF
Hello Tammy,
There can be lot of reasons for this to happen,
1. If there is no action attribute defined
2. If there are any validation errors in the page, then the action method in the bean is not invoked and just the page refreshes.
3. If Navigation is not defined in the facesConfig.xml, then the same page refreshes....

Hope this helps you...

-Rajani
17 years ago
JSF
Hello Suresh,
Here is a sample code to create a JSF Menu using tomahawk <t:tree> component. In the JSP,


In the backing bean,


Hope this is what you are looking for. Or else there are some previously discussed topics on jsf menu using tree component. Please refer those also.

Thanks,
Rajani.
17 years ago
JSF
Hello Efrat,

Sorry before this, I couldn't understand the exact situation of how the user can submit the page without clicking the command button.
Ok I had a similar situation. In my case, if the user is doing an activity type and if he is in the middle of it and clicks on any other menu item or navigation tree, then we are showing an alert to warn user with message, "Are you sure you want to cancel this activity".
This is done in the backing bean.
In your case, set a boolean variable in the backing bean,and check if the user is in the current page,(or any other condition) and set boolean to true, else false and save the state of it in the page. So now whenever any other item in the menu is clicked, the action attribute of that menu item calls a method in the backing bean. That method should check for the boolean value and return the javaScript alert, Check for this condition in all the other items action methods, which the user can click on that page, except the commandButton.
For Eg., in the jsp, each menu item will be,


In the bean,


This method will return the javascript alert without submitting the current page.

Hope this helps,

-Rajani.
17 years ago
JSF
Hi Jack,
I did something similar to this. In the login.jsp page the code should be,


The "info" is in styleSheet.
and also save the state of boolean variable in login.jsp,



and in the managed bean, declare a boolean variable and handle the infoMessage in the logout method. For eg.



I think you can do this without boolean variable also. But I am not sure. I used the flag because I had different scenarios to display the message.
Hope this helps....

-Rajani.
17 years ago
JSF
Hello Joe,

Did you find out a solution for this. If yes, can you tell me how?

-Rajani.
17 years ago
JSF
Hello,
You can go through the Core JavaServer Faces(you can buy it at amazon.com) or the O'Reilly Java Server Faces is also good.

-Rajani.
17 years ago
JSF
Hi,

The commandButton has rendered attribute. You can use it.

For eg.


-Rajani.
17 years ago
JSF
Hi Efrat,
In the JSF page, the command button will have both the onclick and action attributes. First the onclick method is called before the action attribute, if you click the command button. So first the javascript function is executed,


For eg. in this function,
function confirmCancellation(){

var confirmation = confirm(' Your Selection Cancels the activity');
var flag;
if(confirmation){
flag=true;

}else{
flag=false;
}
return flag;
}

This function opens an alert window. If "Yes" on alert window is clicked, then it will load the new url depending upon the value given in the "action" attribute of the command button(here the javascript function returns true, so the action attribute of command button is executed). If you click on "no" of the alert, the javascript function will return false and the page will not be submitted,(it will reload the same url without refreshing/submitting the page) and all the changes you have done will remain same. Just the alert will be closed.

This is working fine for me. In my case, the situation is, if I am in the middle of an activity and want to cancel the activity, I click on the cancel button. It will open an alert which says 'Your Selection Cancels the activity'. If I click "yes", I will be taken to the starting page. If I click "No", Then the alert window closes and I will remain in the same previous page where I was before(without submitting this page again).

Hope this should work for you also

-Rajani.
17 years ago
JSF
Hello, This can be done by using javascript. The javascript function should return a boolean value. If the function returns false, then the page will not be submitted, else it will perform the action. For eg.

In the jsf page, the onclick attribute of commandButton should return false,

"if(!confirmCancellation()){return false;}"

And the javaScript function should be,

function confirmCancellation(){

var confirmation = confirm(' Your Selection Cancels the activity');
var flag;
if(confirmation){
flag=true;
}else{
flag=false;
}
return flag;
}


Hope this helps.....

-Rajani.
17 years ago
JSF
Joe,

In my case, I have a set of commandLinks with different values. when I click on each of the commandlink, the value of the commandLink is passed as parameter, and I am getting its value from the backing Bean and displaying it in the next page.

This is what you are looking for???

-Rajani
17 years ago
JSF
Hello Joe,

In the parent window,
use the <f:param> to pass the parameter. For eg,



and in the child Bean, get the parameter by using the name attribute of <f:param>. for eg.

public String someAction(){
String result = null;
Map parameters = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
String value = (String) parameters.get("activityAction");
this.setActivityName(value);
if(value == null || value.length() == 0){
throw new IllegalArgumentException("Could not find parameter 'activityAction' in request parameters");
}else{
result = ......
}
return result;
}

public String getActivityName() {
return activityName;
}

public void setActivityName(String activityName) {
this.activityName = activityName;
}

And in the child window jsp, get the value from the child bean.

I think this is what you want. Hope this helps....

-Rajani.
17 years ago
JSF
Hello,

In the JSF page,

<h:selectBooleanCheckbox value="#{res.booleanValue}" >

and in the backingBean, to check for multiple selections,

private UIData HTMLTableName;

public UIData getHtmlTableName() {
return htmlTableName;
}
public void setHtmlTableName(UIData htmlTableName) {
this.htmlTableName = htmlTableName;
}

SelectableItem item = (SelectableItem) htmlTableNam.getRowData();
if (item.isSelected()) {

} else {
}


or

for (int i = 0; i < displayingList.size(); i++) {

SelectableItem item = (SelectableItem) displayingList.get(i);
if (item.isSelected()) {
}
else{
}

Hope this helps....

-Rajani.
17 years ago
JSF
Hi Vinutha,
This is my javaScript function to open a new window and if it is not closed, and the button is clicked again, the already opened window is focused, instead of opening a new second window.


Hope this helps

-Rajani.
17 years ago
JSF
Hello Naveen,
I think this how you want to display the tree,

http://myfaces.apache.org/tomahawk/tree.html

The code for the above example is

The JSF page is,



and the backing Bean is.....



Hope this helps....

Rajani.
[ January 29, 2007: Message edited by: rajani varma ]
17 years ago
JSF