Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Who has the focus?

 
Wander Soares
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to know where the focus of the application is in the server side, i.e., i need to know in the backingbean where the focus is. Any idea?
 
Cesar Loachamin
Ranch Hand
Posts: 90
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you explain better what you need, because you mean focus ???
 
Wander Soares
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What component of the aplication(textboxs,buttons,...) has the focus,i.e, is selected.
 
Cesar Loachamin
Ranch Hand
Posts: 90
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi wandroide

First above all I suggest you read about the JSF request process lifecycle and understand all phases as soon a request is produced until de page is rendered.
I suggest you also read about the MVC model, wich is where it is based jsf.
That said, when in the client (browser) a component is selected (has the focus) the server does not know anything about this, becuase have not been a request to the server.
One solution to know the component that has the focus in the server is using ajax, you can make a partial request for all components you want when any component has the focus.
If you're using JSF 2.0 you can do it like this:

All the component's between the <f:ajax> and </f:ajax> make a partial request for the onfocus event and call the method especified by the listener attribute
And the method for the listener

I hope this can help you to solve your problem, sorry for my English.

Regards

Cesar
 
Wander Soares
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic