In volume 2 of CoreServlets and JavaServer Pages, Marty Hall
recommends using a url-pattern for the JSP to match its original URL.
However, I cannot do this in Appengine and provide init-param for the
JSP page.
If I have a InitPage.jsp shown below in the war folder, (war/
InitPage.jsp) and if I have a url-pattern of /InitPage.jsp shown in
below web.xml then I will get a 500 Server Error each time with a
error log description of "java.lang.IllegalStateException: No forced
path servlet for /InitPage.jsp"
Is there any way that I can have a jsp in the war folder with the same
name for a URL-Pattern and pass intialization parameters to the page.
Thanks
Dave
InitPage.jsp
=========
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD><TITLE>JSP Init Test</TITLE></HEAD>
<BODY BGCOLOR="#FDF5E6">
<H2>Init Parameters:</H2>
<UL>
<LI>First name: <%= firstName %>
<LI>Email address: <%= emailAddress %>
</UL>
</BODY></HTML>
<%!
private String firstName = "First name is missing.";
private String emailAddress = "Email address is missing";
public void jspInit() {
ServletConfig config = getServletConfig();
if (config.getInitParameter("firstName") != null) {
firstName = config.getInitParameter("firstName");
}
if (config.getInitParameter("emailAddress") != null) {
emailAddress = config.getInitParameter("emailAddress");
}
}
%>
web.xml
=======
<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://
java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5"
>
<servlet>
<servlet-name>InitPage</servlet-name>
<jsp-file>/InitPage.jsp</jsp-file>
<init-param>
<param-name>emailAddress</param-name>
<param-value>[email protected]</param-value>
</init-param>
<init-param>
<param-name>firstName</param-name>
<param-value>Bill</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>InitPage</servlet-name>
<url-pattern>/InitPage.jsp</url-pattern>
</servlet-mapping>
</web-app>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.