Any help is appreciated!?! I am beginning to think this is a glassfish bug
and will wait a day or two before filing.
The URL encoded query string still gets mangled. I expect:
http://localhost:8081/JSPForm/?Term=blah&Definition=blah&submit=Process
I get:
http://localhost:8081/JSPForm/%3fTerm%3dblah%26Definition%3dblah%250D%250A%26submit%3dProcess
Can someone provide me an example with configuration that works? This is
completely non-obvious to me, and the application is braindead simple.
The descriptor I am using should cover all cases:
<locale-charset-info default-locale="en_US">
<locale-charset-map agent="" charset="UTF-8" locale="en_US"/>
<parameter-encoding default-charset="UTF-8"
form-hint-field="charsetField"/>
</locale-charset-info>
<parameter-encoding default-charset="UTF-8"
form-hint-field="charsetField"/>
I have a hidden field on my form in the JSP file as <input type="hidden"
name="charsetField" value="UTF-8">
It seems to me that the defaults that NetBeans generates should by default
agree and work. Why is this a problem in glassfish, but works without issue
in Tomcat?
Thanks,
ITVGuy2000
I am running Netbeans 5.5.1 on Windows XP SP2 and JDK 1.5.0_11 with VWPack
5.5.1 installed deploying to SJSAS PE 9.0_01_b02. The Windows CLASSPATH
environment variable is nil.
ITVGuy2000 wrote:
>
> I have a very simple JSP application that runs perfectly on Tomcat, but
> won’t run correctly on glassfish. I am guessing I have messed up some
> configuration for the web application, but I am not sure where.
>
> The JSP simply presents a form first time through, the subsequently (after
> submitted) displays the parameters to the page.
>
> When I run this application on glassfish, I get a 404-The requested
> resource () is not available. The problem seems to be that the query
> string is being incorrectly encoded.
>
> When I look at the address line of my browser I see:
> http://localhost:8081/JSPForm/%3fTerm%3dblah%26Definition%3dblah%250D%250A%26submit%3dProcess
> rather than:
> http://localhost:8081/JSPForm/?Term=blah&Definition=blah&submit=Process
> If I in fact type this query string by hand into the address line, my JSP
> happily displays the results blah and blah.
>
> I am guessing this has to do with document/page/parameter encoding, but I
> am not sure where I have this configured wrong. I am utilizing the default
> web.xml and web-app.xml generated by NetBeans. I have tried setting the
> default character set encoding in the sun-web.xml to both ‘UTF-8’ and to
> ‘ISO-8859-1’ with no effect.
>
> Am I doing something wrong, or is this a bug?
>
> ITVGuy2000
>
> ---------------- index.jsp ---------------
>
> <%_at_page contentType="text/html"%>
> <%_at_page pageEncoding="UTF-8"%>
> <%_at_page import="java.util.*"%>
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
>
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html;
> charset=UTF-8">
> <title>TestJSPForm</title>
> </head>
> <body>
>
> <center>
> <h1>TestJSPForm</h1>
> Today's date is: <%= new Date() %>
> </center>
> <%
> if (request.getParameter("Term") == null &&
> request.getParameter("Definition")
> == null)
> {
> %>
> <CENTER>
> <H2>Glossary Info Form</H2>
> <FORM METHOD="GET" ACTION=”/TestJSPForm”>
> <table width="300" border="0">
> <tr>
> <td width="122">Term: </td>
> <td width="168"><input type="text" name="Term"
> size=40></td>
> </tr>
> <tr>
> <td> Definition: </td>
> <td><textarea name="Definition"
> cols="40"></textarea></td>
> </tr>
> <tr>
> <td colspan="2"> </td>
> </tr>
> <tr>
> <td colspan="2"><div align="center">
> <input name="submit" type="submit"
> value="Process">
> </div></td>
> </tr>
> </table>
> </FORM>
> </CENTER>
> <%
> }
> else
> {
> %>
> <P align="center">
> The Glossary Entry you have provided:
> <P align="center"> <table width="482" border="0"
> align="center">
> <tr valign="top">
> <td width="140">Term:</td>
> <td width="332"><%= request.getParameter("Term") %></td>
> </tr>
> <tr valign="top">
> <td><P align="left">Definition: </td>
> <td><%= request.getParameter("Definition") %></td>
> </tr>
> </table>
> <% } %>
> </body>
> </html>
>
> ------------------- sun-web.xml ----------------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application
> Server 9.0 Servlet 2.5//EN"
> "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
> <sun-web-app error-url="">
> <context-root>/TestJSPForm</context-root>
> <class-loader delegate="true"/>
> <jsp-config>
> <property name="classdebuginfo" value="true">
> <description>Enable debug info compilation in the generated servlet
> class</description>
> </property>
> <property name="mappedfile" value="true">
> <description>Maintain a one-to-one correspondence between static
> content and the generated servlet class' java code</description>
> </property>
> </jsp-config>
> </sun-web-app>
>
> ------------------- web.xml ----------------------------
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <web-app xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
> version="2.5">
> <session-config>
> <session-timeout>
> 30
> </session-timeout>
> </session-config>
> <welcome-file-list>
> <welcome-file>
> index.jsp
> </welcome-file>
> </welcome-file-list>
> </web-app>
>
--
View this message in context: http://www.nabble.com/URL-Encoded-Query-String-Wrong-tf3823657.html#a10832410
Sent from the java.net - glassfish users mailing list archive at Nabble.com.