File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes how to move a variable's value from bean page  to another java class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "how to move a variable Watch "how to move a variable New topic

how to move a variable's value from bean page to another java class

Swela Jathar

Joined: Aug 19, 2011
Posts: 22

I am totally new to JSF 2.0.I am creating simple registration form using mysql 5.1,and netbeans 6.5.and i have created separate java class for database connection.i have written insert query in that class.n i want to access variables from jsf bean page(i.e
how to move a variable's value from jsf's bean page to another java class?
Thanks in advance...
Jhonnathan Emilio Cardona Saineda
Ranch Hand

Joined: Jan 24, 2012
Posts: 30

here is the page.jsp... and a input field..-->
<h:inputText id="helloInput" value="#{helloBean.number}"
<h:commandButton id="button" type="submit"

and here is

public class HelloBean
private int number;
//this property is sincronized with the page
public int getNumber()
return numControls;
public void setNumber(int number )
this.number = number ;

// method fired by the button

public void action(ActionEvent actionEvent)
Javaclassfordatabaseconnection miClass = Javaclassfordatabaseconnection();
miClass.insert( number );

It is sorta covered in the JavaRanch Style Guide.
subject: how to move a variable's value from bean page to another java class
Similar Threads
How this bean is remembering the state?
Getting ActionForm values from Java class
Ajax4JSF - Can't generate ajax call from JSF page
how to access a session value on JSF page?
create multiple checkboxes with Data base values in jsf page