• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

h:commandButton

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you post your code, it's not easy to follow without it.
 
raghu namala
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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...)
 
Ranch Hand
Posts: 30
Hibernate Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you have action="#{managedBean.testAction}"
then you can use the code to return any page



 
Saloon Keeper
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
https://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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic