You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Helmut Swaczinna <my...@wlp-systems.de> on 2008/12/09 12:51:02 UTC

[Tobago] Problem with NonFacesRequestServlet (correction)

Hi,

I just tried to use the NonFacesRequestServlet but I got a problem I can't
solve. The servlet is
called and the initial page is displayed as expexted. But when I execute an
action on the page
the URL is prepended with the servlet name and cannot be resolved:

This is the initial URL wich calls the NonFacesRequestServlet

http://localhost:8080/MyWebapp/OpenMediaRequest.jsf?titel=abc

When I execute an action the URL is

http://localhost:8080/MyWebapp/OpenMediaRequest.jsf/edit.xml;jsessionid=59135BB960B04D4B759D5ECFAB6074FA

This is my web.xml

  <context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xml</param-value>
  </context-param>

  <servlet>
    <servlet-name>FacesServlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>3</load-on-startup>
  </servlet>

  <servlet>
    <servlet-name>OpenMediaRequestServlet</servlet-name>
    <servlet-class>de.wlps.ndr.workflow.beitragsid.webapp.web.OpenMediaRequestServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>FacesServlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>OpenMediaRequestServlet</servlet-name>
    <url-pattern>/OpenMediaRequest.jsf</url-pattern>
  </servlet-mapping>

and my faces-config.xml

  <navigation-rule>
    <navigation-case>
      <from-outcome>edit</from-outcome>
      <to-view-id>/edit.xml</to-view-id>
    </navigation-case>
  </navigation-rule>

This is the NonFacesRequestServlet

public class OpenMediaRequestServlet extends NonFacesRequestServlet {

  private static final Log LOG =
LogFactory.getLog(OpenMediaRequestServlet.class);

  public String invokeApplication(FacesContext facesContext) {

    String titel =
(String)facesContext.getExternalContext().getRequestParameterMap().get("titel");
    LOG.info("invokeApplication: titel='" + titel + "'");

    return "edit";
  }

}


Did I something wrong? I don't think so. I'm using Tobago 1.013. Please
help!

Regards
Helmut






Re: [Tobago] Problem with NonFacesRequestServlet (correction)

Posted by Helmut Swaczinna <my...@wlp-systems.de>.
Hi Bernd,

yes, I forgot to say that I'm using facelets. And I'm using myfaces 1.1.5.
Hm, is there no chance to use the NonFacesRequestServlet with facelets and 
myfaces impl?
In the meantime, I experimented with a standard HTTPServlet and redirect 
instead of jsf navigation.
This approach seems to work.

Regards and thanks
Helmut

----- Original Message ----- 
From: "Bernd Bohmann" <be...@atanion.com>
To: "MyFaces Discussion" <us...@myfaces.apache.org>
Sent: Tuesday, December 09, 2008 3:54 PM
Subject: Re: [Tobago] Problem with NonFacesRequestServlet (correction)


> Hello Helmut,
>
> I asume you are using facelets?
> Which JSF Implementation are you using?
> In a internal project I switched from myfaces impl to sun ri because of
> this issue.
>
> Regards
>
> Bernd
>
> Helmut Swaczinna schrieb:
>> Hi,
>>
>> I just tried to use the NonFacesRequestServlet but I got a problem I 
>> can't
>> solve. The servlet is
>> called and the initial page is displayed as expexted. But when I execute 
>> an
>> action on the page
>> the URL is prepended with the servlet name and cannot be resolved:
>>
>> This is the initial URL wich calls the NonFacesRequestServlet
>>
>> http://localhost:8080/MyWebapp/OpenMediaRequest.jsf?titel=abc
>>
>> When I execute an action the URL is
>>
>> http://localhost:8080/MyWebapp/OpenMediaRequest.jsf/edit.xml;jsessionid=59135BB960B04D4B759D5ECFAB6074FA
>>
>>
>> This is my web.xml
>>
>>  <context-param>
>>    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
>>    <param-value>.xml</param-value>
>>  </context-param>
>>
>>  <servlet>
>>    <servlet-name>FacesServlet</servlet-name>
>>    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>>    <load-on-startup>3</load-on-startup>
>>  </servlet>
>>
>>  <servlet>
>>    <servlet-name>OpenMediaRequestServlet</servlet-name>
>>
>> <servlet-class>de.wlps.ndr.workflow.beitragsid.webapp.web.OpenMediaRequestServlet</servlet-class>
>>
>>    <load-on-startup>1</load-on-startup>
>>  </servlet>
>>
>>  <servlet-mapping>
>>    <servlet-name>FacesServlet</servlet-name>
>>    <url-pattern>*.jsf</url-pattern>
>>  </servlet-mapping>
>>
>>  <servlet-mapping>
>>    <servlet-name>OpenMediaRequestServlet</servlet-name>
>>    <url-pattern>/OpenMediaRequest.jsf</url-pattern>
>>  </servlet-mapping>
>>
>> and my faces-config.xml
>>
>>  <navigation-rule>
>>    <navigation-case>
>>      <from-outcome>edit</from-outcome>
>>      <to-view-id>/edit.xml</to-view-id>
>>    </navigation-case>
>>  </navigation-rule>
>>
>> This is the NonFacesRequestServlet
>>
>> public class OpenMediaRequestServlet extends NonFacesRequestServlet {
>>
>>  private static final Log LOG =
>> LogFactory.getLog(OpenMediaRequestServlet.class);
>>
>>  public String invokeApplication(FacesContext facesContext) {
>>
>>    String titel =
>> (String)facesContext.getExternalContext().getRequestParameterMap().get("titel");
>>
>>    LOG.info("invokeApplication: titel='" + titel + "'");
>>
>>    return "edit";
>>  }
>>
>> }
>>
>>
>> Did I something wrong? I don't think so. I'm using Tobago 1.013. Please
>> help!
>>
>> Regards
>> Helmut
>>
>>
>>
>>
>>
>>
> 


Re: [Tobago] Problem with NonFacesRequestServlet (correction)

Posted by Bernd Bohmann <be...@atanion.com>.
Hello Helmut,

I asume you are using facelets?
Which JSF Implementation are you using?
In a internal project I switched from myfaces impl to sun ri because of
this issue.

Regards

Bernd

Helmut Swaczinna schrieb:
> Hi,
> 
> I just tried to use the NonFacesRequestServlet but I got a problem I can't
> solve. The servlet is
> called and the initial page is displayed as expexted. But when I execute an
> action on the page
> the URL is prepended with the servlet name and cannot be resolved:
> 
> This is the initial URL wich calls the NonFacesRequestServlet
> 
> http://localhost:8080/MyWebapp/OpenMediaRequest.jsf?titel=abc
> 
> When I execute an action the URL is
> 
> http://localhost:8080/MyWebapp/OpenMediaRequest.jsf/edit.xml;jsessionid=59135BB960B04D4B759D5ECFAB6074FA
> 
> 
> This is my web.xml
> 
>  <context-param>
>    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
>    <param-value>.xml</param-value>
>  </context-param>
> 
>  <servlet>
>    <servlet-name>FacesServlet</servlet-name>
>    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>    <load-on-startup>3</load-on-startup>
>  </servlet>
> 
>  <servlet>
>    <servlet-name>OpenMediaRequestServlet</servlet-name>
>   
> <servlet-class>de.wlps.ndr.workflow.beitragsid.webapp.web.OpenMediaRequestServlet</servlet-class>
> 
>    <load-on-startup>1</load-on-startup>
>  </servlet>
> 
>  <servlet-mapping>
>    <servlet-name>FacesServlet</servlet-name>
>    <url-pattern>*.jsf</url-pattern>
>  </servlet-mapping>
> 
>  <servlet-mapping>
>    <servlet-name>OpenMediaRequestServlet</servlet-name>
>    <url-pattern>/OpenMediaRequest.jsf</url-pattern>
>  </servlet-mapping>
> 
> and my faces-config.xml
> 
>  <navigation-rule>
>    <navigation-case>
>      <from-outcome>edit</from-outcome>
>      <to-view-id>/edit.xml</to-view-id>
>    </navigation-case>
>  </navigation-rule>
> 
> This is the NonFacesRequestServlet
> 
> public class OpenMediaRequestServlet extends NonFacesRequestServlet {
> 
>  private static final Log LOG =
> LogFactory.getLog(OpenMediaRequestServlet.class);
> 
>  public String invokeApplication(FacesContext facesContext) {
> 
>    String titel =
> (String)facesContext.getExternalContext().getRequestParameterMap().get("titel");
> 
>    LOG.info("invokeApplication: titel='" + titel + "'");
> 
>    return "edit";
>  }
> 
> }
> 
> 
> Did I something wrong? I don't think so. I'm using Tobago 1.013. Please
> help!
> 
> Regards
> Helmut
> 
> 
> 
> 
> 
>