File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes form address inverse Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "form address inverse" Watch "form address inverse" New topic
Author

form address inverse

tuntun zaw
Greenhorn

Joined: Oct 23, 2007
Posts: 4
Address inverse
My welcome file is welcome.faces redirected by index.html. When browser load welcome.faces, address bar show like �http://localhost/logo/welcome.faces�.When click the command buttom after filling text box, browser load success.faces. But address bar show �http://localhost/logo/welcome.faces�. When click command buttom in success.faces, browser load welcome.faces. But address bar show �http://localhost/logo/success.faces�. At this time, when click the command buttom in welcome.faces without no change in text box, address bar change from �http://localhost/logo/success.faces� to �http://localhost/logo/welcome.faces�.But form have no change.What is wrong?
My web service directory is apache tomcat.

Give me correct flow and why?
My email address is tunzaw2008@gmail.com.

Here is my code.
web.xml.
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>

welcome.jsp

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<html>
<head>
<title>Hello Welcome</title>
</head>
<body>
<f:view>
<h:form id="inputname">

<p>
<hutputText value="Enter name:"/>
</p>


<h:inputText value="#{namebean.username}" required="true">

</h:inputText>

<h:commandButton value="Submit" action="success"/>


</h:form>
</f:view>
</body>
</html>

success.jsp
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<html>
<head>
<title>Successful</title>
</head>
<body>
<f:view>
<h:form id="Successful">

<p>
<hutputText value="Hi "/>
<hutputText value="#{namebean.username}"/>
</p>

<h:commandButton value="Submit" action="welcome"/>
</h:form>
</f:view>
</body>
</html>
namebean.java

package jsfclasses;

public class namebean{
private String username;
private String r;

public void setUsername(String name){
this.username=name;
}

public String getUsername(){
return username;
}

}

faces-config.xml

<navigation-rule>
<from-view-id>/welcome.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/success.jsp</to-view-id>
</navigation-case>
</navigation-rule>

<navigation-rule>
<from-view-id>/success.jsp</from-view-id>
<navigation-case>
<from-outcome>welcome</from-outcome>
<to-view-id>/welcome.jsp</to-view-id>
</navigation-case>
</navigation-rule>

<managed-bean>
<managed-bean-name>namebean</managed-bean-name>
<managed-bean-class>jsfclasses.namebean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>

</managed-bean>
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 12513

A lot of people don't like the fact that the displayed URL in a JSF application doesn't track the actual pages. All JSF cares about is that the displayed page contains enough hidden information to keep the conversation flowing.

Actually, this is mostly a problem when you try and bookmark a page, since the context won't be there if you jump direct. People have been working on this.


One of the most odious afflictions that Business has inflicted on the modern English language is "pro-active". Most of the time it's simply redundantly used in place of the simple old word "active". And a good deal of the rest of the time it means "You're not overworked enough yet, so go out and find more!"
 
 
subject: form address inverse
 
Threads others viewed
form and address do not match.
EL expressions are not evaluated
Simple Application
navigation rules are not working...
inputText tag not working properly
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com