I am just a beginner at JSF So I didn't know whether it is right question.
Is it possible that If I make a form with JSF tags/components and define a servlet for action attribute (i.e can form data submitted to a servlet) and if yes then How can I achieve this and How can I get form parameters in servlet. Is it same as request.getParameter() of method or anything else.
I am going to make a project for my self practice and want to use JSF,SERVLET AND JSP all together.
Form data submitted from a JSF form with a JSF commandButton gets sent to the managed bean you specify in the input fields. I'm no expert but as far as I know you can't directly access a servlet using JSF components. Why are you trying to mix all three anyway? I would recommend using Servlet and JSP seperately to learn request/response as JSF is built on top of Servlet. Once you get a grasp of that then start using JSF. I have only started with JSF myself after using servlets and JSP for some time. Knowing the latter helped my understanding when I started with JSF.
JSF Views (forms) are always sent to the FacesServlet. The FacesServlet is self-contained and only rarely subclassed - not something that you should be doing at beginner-level. In fact, not something I've needed to do in 6 years working with JSF.
A JSF app can have JSF Views, JSP pages and Servlets, but the JSPs and servlets don't directly interact with JSF View definitions. They can, however, share data, since a JSF session- or application-scoped ManagedBean is the same bean as a servlet/JSP bean of the same name/scope. All the ManagedBean facility does is automate the creation of that bean on demand by JSF without the need for user coding.
I actually don't recommend attempting to mix JSP, servlet and JSF in a single app if you are a beginner. Not until you need to do non-JSF things like create PDFs or Excel files. Concentrate on one venue at a time until you know how it works and how it interacts with JEE in general.
Also, be careful with old documentation. In JSF Version 1, the View Definition Language was JSP. In JSF Version 2, it is not, nor does the JSV2 View template get compiled into Java code like regular JSPs do.
Customer surveys are for companies who didn't pay proper attention to begin with.
Abhilash Sharma wrote:Thanks a Alan and Tim for your valuable suggestions. I think firstly,I need to built my app with JSP and Servlets and then transform it to JSF.(just to learn how things work with jsf)
That may not be as effective as you hope. JSF has a very different approach to webapps than servlets and JSPs do.
So what you are saying is that I should concentrate on JSP AND SERVLETS and leave JSF. I am a fresher and will applying for jobs soon. So, I thought may be I should learn JSF (may be JSP+SERVLETS AND JSF LOOKS GOOD ON RESUME).
Couple of days back,I bought this CORE JAVASERVER FACES book ,start learning and found the difference between the approaches.(like form data directly send to bean wheras in other case it would sent to servlet/jsp).
When applying for jobs, the best strategy is to see what employers in your area are demanding and concentrate on that. Not so long ago, around here that would have been Struts.
Technically, form data isn't "sent directly" to a bean. It's sent to the FacesServlet, which acts as the Master Controller. JSF handles getting the data to/from beans.
If I were hiring, more important that specific frameworks to me would be how well you understand basic HTTP and Model/View/Controller. A lot of people don't understand HTTP very well at all. If you have a good understanding of those two concepts and how they work, then the more specific frameworks such as JSP/Servlet, Struts, JSF, Tapestry, and so forth will make a lot more sense to you.
Sorry for insolent question, but...
Once I was preparing for interview where I was like from neighboring planet.
I didn't know what was HTTP( luckily they didn't ask me) and how data is sent over the Internet (question from another interview).
I understand that user submits data. How does data go through network and what it has to do with HTTP protocol? At Apply request values phase user's data is assigned to variable 'submittedValue' of corresponding UIComponent. Why is String assigned to submittedValue and
only after that conversion is applied?
My interviewers asked similarly as Tim would ask.
At one interview I was told that I needed a good study at first, at another they recommended me to move to Struts and Tapestry. I told that JSF is better but I could not explain why. I hope jsf is better.
Sorry for shameless questions but it is the only place for me to ask.