• Post Reply Bookmark Topic Watch Topic
  • New Topic

wierd JSF problem - URL changing

 
Arnie Morein
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been working on a simple two-page JSF app. The first page is a login that is required before you get to the search page. It is JSF running on Tomcat 5.5.20.

I had it working. Then I had a problem with SVN and Eclipse. Lost some code but got it back. EXCEPT...

After the user authenticates, it goes the second page and everything looks good. The user enters the credentials and hits search. The page returns with the data, but from there after, the URL has changed! Instead of:

:8080/DpsLicenseInquiry/pageTwo.jsf, it is:

:8080/DpsLicenseInquiry/pages/pageTwo.jsf

I haven't the foggiest idea what is doing this. I've checked the web.xml file to no avail. (See below).

The 'security' on the application is handled through a AuthorizationFilter that checks for access rights to the one page under /pages/pageTwo.jsp

The userLogin.jsp and the requestAccess.jsp and verifyAccessRequest.jsp pages are in the root of the context so they work fine.

Anyone have any ideas as to what might be going on?


--------------
web.xml
--------------
<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

<display-name>DPS License Inquiry</display-name>

<resource-ref>
<description>Agency AppSec DB Connection</description>
<res-ref-name>jdbc/ApplicationSecurity</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Unshareable</res-sharing-scope>
</resource-ref>

<resource-ref>
<description>DPS DB Connection</description>
<res-ref-name>jdbc/DpsLicenses</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Unshareable</res-sharing-scope>
</resource-ref>

<filter>
<filter-name>AuthorizationFilter</filter-name>
<filter-class>us.tx.state.oag.DpsLicenseInquiry.AuthorizationFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>AuthorizationFilter</filter-name>
<url-pattern>/pages/*</url-pattern>
</filter-mapping>

<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
<context-param>
<!-- Faces Context Configuration -->
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/config/faces-config.xml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
<!--
<description>
State saving method: "client" or "server" (= default)
See JSF Specification 2.5.2
</description>
-->
</context-param>
<context-param>
<param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
<param-value>true</param-value>
<!--
<description>
This parameter tells MyFaces if javascript code should be allowed in the
rendered HTML output.
If javascript is allowed, command_link anchors will have javascript code
that submits the corresponding form.
If javascript is not allowed, the state saving info and nested parameters
will be added as url parameters.
Default: "true"
</description>
-->
</context-param>
<context-param>
<param-name>org.apache.myfaces.PRETTY_HTML</param-name>
<param-value>true</param-value>
<!--
<description>
If true, rendered HTML code will be formatted, so that it is "human
readable".
i.e. additional line separators and whitespace will be written, that do not
influence the HTML code.
Default: "true"
</description>
-->
</context-param>
<context-param>
<param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
<param-value>true</param-value>
<!--
<description>
If true, a javascript function will be rendered that is able to restore the
former vertical scroll on every request. Convenient feature if you have pages
with long lists and you do not want the browser page to always jump to the
top
if you trigger a link or button action that stays on the same page.
Default: "false"
</description>
-->
</context-param>
<listener>
<!-- Listener, that does all the startup work (configuration, init). -->
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
<servlet>
<!-- Faces Servlet -->
<servlet-name>faces</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>nitrox-debugger-tomcat5</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>suppressSmap</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>nitrox-debugger-tomcat5</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
<servlet-mapping>
<!-- Faces Servlet Mapping -->
<servlet-name>faces</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>

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

<jsp-config>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/tld/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/fmt</taglib-uri>
<taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/sql</taglib-uri>
<taglib-location>/WEB-INF/tld/sql.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/xml</taglib-uri>
<taglib-location>/WEB-INF/tld/x.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/functions</taglib-uri>
<taglib-location>/WEB-INF/tld/fn.tld</taglib-location>
</taglib>
</jsp-config>

</web-app>
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the structure of your web application?
 
Arnie Morein
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The folder structure is:

\web\pages\includes\header.jsp
\web\pages\licenseQuery.jsp (the only secure page)
\web\resources\<css and js files>
\web\WEB-INF\classes
\web\WEB-INF\config
\web\WEB-INF\lib
\web\WEB-INF\src
\web\WEB-INF\tld
\web\userLogin.jsp (default page)
\web\requestAccess.jsp
\web\verifyAccessRequest.jsp
\web\index.jsp (forwards to userLogin.jsp)
[ December 27, 2006: Message edited by: Arnie Morein ]
 
Arnie Morein
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've figured this out - I think. I had to put <redirect/> on my navigation cases and the URL of the target page showed up correctly the first time the page appears, therein the paths to graphics and JS files were correct.

Is this an intentional JSF behavior?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!