JSF delegates all state/business logic to POJO beans. So you can just declare a session scoped 'LoginBean':
// think merging the ActionForm and Action in one object
public class LoginBean {
private String name;
private String password;
private UserProfile user;
private @Resource ... myDataSource;
// get/set for name and password
// equivalent to Action.execute(...)
// but any bean can have any number of callable methods
public String login() {
UserDao dao = new UserDao(myDataSource);
this.user = dao.find(this.name, this.password);
// can also use enums
return (this.user != null) "success" : "fail";
}
}
Then in your page, you can just create a form:
<h:inputText value="#{loginBean.name}"/>
<h:inputSecret value="#{loginBean.password}"/>
<h:commandButton action="#{loginBean.login}"/>
---
Given JSF is distributed as part of glassfish, I guess the question is
appropriate here. Is there a forum/newsgroup/mailing list that is well
supported and deals with JSF questions?
My question:
I have run through the Netbeans tutorial for JSF framework introduction plus
the validation and conversion tutorial. It was a pretty useful tutorial, but
it left me wanting. To be fair, it exposed me to:
- Managed Beans and how to reference them in a JSP.
- Configuring Navigation in the Faces-config.xml.
- Validation.
- Conversion.
- Some of the convenience features of Netbeans.
All very useful, but stuff I already feel comfortable with. What I can't
seem to find is where I put the code that initiates my business logic.
Having done a ton of development in Struts, I am looking for something
equivalent to an Action.execute. Where do you put your entry points into the
business logic? The okay, now that I have all my data from the JSP form, I
need to do something useful with it code. Surely not the managed bean? Is
there an equivalent to the Action.execute from struts in JSF?
I have done lots of searches and have looked in the JEE5 Tutorial, but
nothing is jumping out as equivalent.
I am currently not using VWP, nor do I want to at the moment. If it matters,
I am using Netbeans 5.5.1 to develop apps to run on SJAS Version 9 update 1
patch 1.
Thanks,
ITVGuy2000
--
View this message in context:
http://www.nabble.com/JSF-Questions-tf4075080.html#a11581649
Sent from the java.net - glassfish users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
For additional commands, e-mail: users-help_at_glassfish.dev.java.net