aspose file tools*
The moose likes JSF and the fly likes h:commandButton Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "h:commandButton" Watch "h:commandButton" New topic
Author

h:commandButton

raghu namala
Greenhorn

Joined: Apr 12, 2012
Posts: 4
Hi,

i created a page with h:commandButton..i dont want my page to be navigated to new page when this button is clicked.. i saw some posts on java ranch. i tried to using history.back()..

any help appreciated..

thanks in advance
Brendan Healey
Ranch Hand

Joined: May 12, 2009
Posts: 218
If you have action="#{bean.testAction}" and



is this what you mean? I'm not at all sure what history.back has to do with anything.

Regards,
Brendan.
raghu namala
Greenhorn

Joined: Apr 12, 2012
Posts: 4
hey thanks for the reply Brendan,

i tried that it dint work...

i m using jsf 2.0 facelets...i have tree menu on the left pane... when a click on the tree menu item will display the contents of center pane using ajax(using jquery for it..)..now the contentPane has commandButtons.. when i click this button it should invoke a method on jsf bean..and it should stay on the same page...and also is it possible to get the output of the string to change the color of commandButton???

Brendan Healey
Ranch Hand

Joined: May 12, 2009
Posts: 218
Can you post your code, it's not easy to follow without it.
raghu namala
Greenhorn

Joined: Apr 12, 2012
Posts: 4

login page:
<div id="header"></div>
<div id="footer"></div>
<div id="leftNav>
<ul>
<li>menu1</li>
<li>menu2<li>


</div>

<div id="centerPane">
</div>


when click on menu1 fetch myPage1.xhtml and place it in centerPane div...


now my centerPane div has

<div id="centerPane">
<div id="status" ></div>
<h:commandButton value="start" action="#{mybean.myMethod1}"actionListener="#{mybean.myMethod2}"/>


</div>

public String myMethod1(){
log.info("this line is printing from the navigateMe method: ");
return null;
}

how click on start commandButton displaying new page(i.e.myPage.xhtml)....[BUT THE VIEW SHOULD BE SAME WITH THE HEADER, FOOTER, LEFT AND CONTENT PANES...)
Prateek Kumar Singh
Greenhorn

Joined: Jan 21, 2011
Posts: 29

If you have action="#{managedBean.testAction}"
then you can use the code to return any page



Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

http://www.coderanch.com/how-to/java/DontWakeTheZombies

However,



Is not true. In JSF1, "pageName" would be the name of a Navigation rule. In JSF2, it can be the name of a navigation rule OR it can be a JSF context-relative URL. ".xhtml" is normally the extension of the resource, not of the URL, and resource paths and URLs are 2 different things that merely happen to resemble each other. You can, in fact, code


Although there's no practical benefit to doing so, since JSF already assumes that it's a JSF URL.

And of course, once again, coding a user-defined login is essentially telling hackers to invade your site and take over.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: h:commandButton