[Tomcat, HTTPD, Servlets & JSP] - Re: How to set Character Encoding correctly?
by lxiao
your setting i think is right.
but location.href=encodeURI("b.jsp?names=??");
why you need to encode. i think:
location.href="b.jsp?names=??";
can be OK.
"spec_third" wrote : Hi,anybody help me
|
| I write two jsp files. Content as following:
| a.jsp
| ------------------------------------------------
|
| | <%@ page language="java" contentType="text/html; charset=UTF-8"%>
| | <html>
| | <HEAD>
| | <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
| | </HEAD>
| | <body>
| | <script language="javascript">
| | function _goto(){
| | location.href=encodeURI("b.jsp?names=??");
| | }
| | </script>
| | </body>
| | </html>
|
| b.jsp
| ------------------------------------------------------------------
|
| | <%@ page language="java" contentType="text/html; charset=UTF-8"%>
| | <html>
| | <HEAD>
| | <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
| | </HEAD>
| | <body>
| | <%
| | request.setCharacterEncoding("UTF-8");
| | String names = request.getParameter("names");
| | System.out.println("Names:"+names);
| | %>
| | </body>
| | </html>
|
| following is configuration:
| jbossweb-tomcat50.sar/server.xml
|
|
| | <Service name="jboss.web" className="org.jboss.web.tomcat.tc5.StandardService">
| | <Connector useBodyEncodingForURI="true" URIEncoding="UTF-8"/>
| |
|
| Console print:
| Names:????????????
|
| While I set 'useBodyEncodingForURI' to false,Console print is OK:
| Names:??
|
| why? what is real meaning of 'useBodyEncodingForURI=true'.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4012288#4012288
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4012288
19Â years, 2Â months
[JBoss and NetBeans] - NameNotFoundException: DefaultDS not bound - Entity Unit (Ca
by htran_888
Hi All,
I have not been able to bind the default Hypersonic database (DefaultDS) in JBoss after having created a simple Entity class (Cabin) and a Persistent Unit (titanPU). Below is the listing from JBoss output:
---------------------------------------------------------------------------------------
17:03:12,109 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=titan.jar,name=TravelAgentBean,service=EJB3 with dependencies:
17:03:12,125 INFO [JmxKernelAbstraction] persistence.units:unitName=titan
17:03:12,156 INFO [EJB3Deployer] Deployed: file:/C:/jboss-4.0.4.GA/server/default/deploy/titan.jar
17:03:12,500 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/
17:03:14,125 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
--- MBeans waiting for other MBeans ---
ObjectName: persistence.units:jar=titan.jar,unitName=titanPU
State: FAILED
Reason: javax.naming.NameNotFoundException: DefaultDS not bound
I Depend On:
jboss.jca:service=ManagedConnectionFactory,name=DefaultDS
ObjectName: jboss.j2ee:jar=titan.jar,name=TravelAgentBean,service=EJB3
State: NOTYETINSTALLED
I Depend On:
persistence.units:unitName=titan
--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: persistence.units:unitName=titan
State: NOTYETINSTALLED
Depends On Me:
jboss.j2ee:jar=titan.jar,name=TravelAgentBean,service=EJB3
ObjectName: persistence.units:jar=titan.jar,unitName=titanPU
State: FAILED
Reason: javax.naming.NameNotFoundException: DefaultDS not bound
I Depend On:
jboss.jca:service=ManagedConnectionFactory,name=DefaultDS
---------------------------------------------------------------------------------------
I do not have any difficulty creating the same EJB (Entity class - Cabin, Entity Unit - titan, Session bean - TravelAgent) using the supplied Ant script (build.xml) provided as part of EJB 3.0 Resource Workbook.
Here is a comparison between the persistence.xml file that came with the exercise and the one produced by Netbeans:
--------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
-
- <persistence-unit name="titan">
<jta-data-source>java:/DefaultDS</jta-data-source>
-
</persistence-unit>
################################################
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="titanPU" transaction-type="JTA">
org.hibernate.ejb.HibernatePersistence
<jta-data-source>DefaultDS</jta-data-source>
</persistence-unit>
-------------------------------------------------------------------------------------
Numerous searches on Google and forums have not been fruitful.
I am running Netbeans 5.5 bundled with JBoss 4.0.4 on Windows 2000/XP.
Many thanks,
Henry
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4012280#4012280
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4012280
19Â years, 2Â months