Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSF: Load a view from an external servlet

843842Jan 21 2007 — edited Jan 30 2007
Hi,

The application is build with jsf(myfaces).
I need to display into an existing view a view generated by an external servlet.

I declared in the web.xml:
<servlet>
<servlet-name>TestServlet</servlet-name>
<servlet class>package.TestServlet</servlet-class>

<load-on-startup>2</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>TestServlet</servlet-name>
<url-pattern>/sevlet/TestServlet</url-pattern>

</servlet-mapping>

In the .jsp I just added on a button:
action="#{bean.invoke}"
Where:
public void invoke()
{
String url = "/servlet/TestServlet";
FacesContext context = FacesContext.getCurrentInstance();
try
{
//ExternalContext ex=context.getExternalContext().;
context.getExternalContext().dispatch(url);

}
catch (Exception e)
{

e.printStackTrace();
}
finally
{
context.responseComplete();
}

}
If I try to run it I get:
message HTTP method POST is not supported by this URL
description The specified HTTP method is not allowed for the requested resource (HTTP method POST is not supported by this URL).
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 27 2007
Added on Jan 21 2007
2 comments
176 views