aspose file tools*
The moose likes JSF and the fly likes related to .do and .faces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "related to .do and .faces" Watch "related to .do and .faces" New topic
Author

related to .do and .faces

Nishita Jain
Ranch Hand

Joined: Mar 30, 2006
Posts: 97
Hi,
i am bit confused related to .do and .faces.
what my question is that when my application is in purely struts or Struts-jsf i got confused when i found this.
what i did was in my web.xml i did entry for faces and do like this.
<servlet>
<servlet-name>faces</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<!-- Standard Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>faces</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
...

</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>


now in my Struts-config file if i write like
<action path="/InstructorLogin"
type="InstructorLoginAction"
validate="true"
input="/jsp/instructorLogin.faces"
name="InstructorLoginBean"
scope="request" >
<forward name="student" path="/jsp/studentInformation.faces" />
<forward name="success" path="/jsp/testListing.faces" />
<forward name="failure" path="/jsp/instructorLogin.faces" />
</action>

this will execute perfectly. remember i use faces everywher though my page is .jsp. then why this thing is running fine.
if instead of faces i write .do then it will give error because it tries to find action related to that.
This same thing is why not happening when i write .faces

Thanks in Advance
Nishita


Nishita
g madhava
Ranch Hand

Joined: Sep 14, 2001
Posts: 85
A servlet container typically services the requests by matching the url-pattern with which the request was received to the best mapped servlet/JSP(If the JSP is also specified in the web.xml) in the web.xml.

<servlet-name>faces</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>

In the above scenario the servlet that's going to handle the request is faces servlet since the mapping of ".faces" page is mapped to it.
Nishita Jain
Ranch Hand

Joined: Mar 30, 2006
Posts: 97
hello,
thnaks for replying but i really couldnt understand what u wrote.
if it finds the mapping and goes to faces servlet then in my mapping i dont have any action like testListing.faces .so what faces servlet wil do here? will it just pass nothing and then then it matches to jsp page.
waiting for response.

Nishita
g madhava
Ranch Hand

Joined: Sep 14, 2001
Posts: 85
Please read the documentation on how an JSF application manages it's lifecycle using the JSF components
Nishita Jain
Ranch Hand

Joined: Mar 30, 2006
Posts: 97
hello, ya i read lifecylcle and i found this using this link
http://www-128.ibm.com/developerworks/library/j-integrate/side-fig2.html

1.The FacesServlet receives the request and gets an instance of the FacesContext from the FacesContextFactory.
2. Delegate life cycle processing
3. Lifecycle executes each phase
4. Component tree created
now here i dont have any jsf component as my page is in struts so dont know how this phase executed . it may not execute.
...
9. Rendering the response
now this is the main pahse where the lookup in the faces configuration file wil be done that is faces.config file. and in my web.xml i dont have this file. and no entry for jsp also.
so now my question is what wil happen now.why this thing still shows me the right page.


And just now i found 1 strange thing.
i tried i thing and i wrote
<forward name="success" path="/jsp/testListing" />
instead of
<forward name="success" path="/jsp/testListing.jsp" />

and it defaultly takes .jsp . i am really not getting what is happening over here.

Nishita
g madhava
Ranch Hand

Joined: Sep 14, 2001
Posts: 85
In the web.xml you had the URL mapping of ".faces" extension mapped to the "Faces Servlet".


<forward name="student" path="/jsp/studentInformation.faces" />


When you have configured this way, the struts action class when doing an actionMapping.findForward("student")
is simply doing a [ RequestDispatcher.forward("/WEBAPP-CONTEXT/jsp/studentInformation.faces") ]
So, what will happen now is that the servlet-container will hand over the processing to the "Faces Servlet"
because of the extension ".faces"
Nishita Jain
Ranch Hand

Joined: Mar 30, 2006
Posts: 97
ya i got that. but my question comes after servlet-container will hand over the processing to the "Faces Servlet".. and that is why in my last reply i wrote about jsf lifecycle and got confused in 9 th pahse which says

<b>9. Rendering the response</b>
now this is the main pahse where the lookup in the faces configuration file wil be done that is faces.config file. and in my project i dont have this file. and no entry for faces.config file also.
so now my question is what wil happen now because there it can not find any response or like that.why this thing still shows me the right page.

Nishita
g madhava
Ranch Hand

Joined: Sep 14, 2001
Posts: 85
Are you sure that you don't have a faces-config.xml file in your project ?
Nishita Jain
Ranch Hand

Joined: Mar 30, 2006
Posts: 97
ya, i am 100% sure.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: related to .do and .faces