tomcat can't see french resource bundle

2008-02-04 Thread wessam

i've a strange problem
my application is done with struts, working local with JDeveloper IDE which
has OC4J embedded server
when i change locale to french local the labels are read correctly

but when i deploy on tomcat labels from resource bundle are read in english
though labels are retrieved from database are read in french normally which
means that local is set to french

any sugesstions please ?
-- 
View this message in context: 
http://www.nabble.com/tomcat-can%27t-see-french-resource-bundle-tp15268739p15268739.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: struts request encoding to utf-8 problem

2008-01-24 Thread wessam




In this case, you've isolated your problem to the database read/write  
phase, which means it's not a Struts issue. You'll need to look again  
at your database configuration and whatever middleware you're using  
to communicate with it (e.g. JDBC, Hibernate). The specifics will  
depend on your database backend, the middleware you're using and your  
own persistence code and configuration.

L.


well i don't think that's the problem in database configuration as there're
other projects works with it fine
concerning middleware, i'm using JDBC
but i donno what should i do to make JDBC middleware compatible with utf-8
encoding

here's a snapet of JDBC connection i used ..

 public Connection dbConnect(String db_connect_string,String db_userid,
String db_password)
 {
 try
 {
 Connection conn = DriverManager.getConnection( db_connect_string,
db_userid, db_password);
 System.out.println(connected);
 return conn;
 }
 catch (Exception e)
 {
 e.printStackTrace();
 return null;
 }
 }
 
 public String getText()
 {
 String text = ;
 Statement statement = null;
  try
  {
 Connection conn = dbConnect(jdbc:oracle:thin:@localhost:1522:fat10g,
test, t);
 statement = conn.createStatement();
 String query = select * from test;
 
 ResultSet resultSet = statement.executeQuery ( query ) ;
 // get the last entered row in test table
 while ( resultSet.next () )
 {
  text = resultSet.getString(test);
 }
// text = new String(text.getBytes(), UTF-8);
 
  }
 catch(Exception e)
 {
 e.printStackTrace();
 }
 finally //ensure statement is closed properly
  {
   try
{
 statement.close () ;
}
   catch ( SQLException e )
{
 
}
  }
 return text;
 }
 
 public void saveText(String text)
 {
 Statement statement = null;
 try
 {
Connection conn =
dbConnect(jdbc:oracle:thin:@localhost:1522:fat10g, test, t);
 statement = conn.createStatement();
String query = insert into TEST (test) values (' + text + ');
boolean result = statement.execute( query ) ;
 }
 catch(SQLException  e)
 {
e.printStackTrace();
 }
 finally //ensure statement is closed properly
  {
   try
{
  statement.close () ;
}
   catch ( SQLException e )
{}
  }
 }

what should i do to middleware ?
-- 
View this message in context: 
http://www.nabble.com/struts-request-encoding-to-utf-8-problem-tp15041079p15061172.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



struts request encoding to utf-8 problem

2008-01-23 Thread wessam

i'm using struts 1.1, oracle 10g environment
i'm facing a problem that i can't save special characters as ẻ, € from the
page to database correctly though i used all the possible ways to set the
encoding to utf-8
her's the code i used
1- in the.jsp page ..
  %@ page language=java pageEncoding=UTF-8
contentType=text/html;charset=UTF-8 %

 and in the header ..
meta http-equiv=Content-Type content=text/html; charset=UTF-8/

and declare the form ..
  form method=post accept-charset=UTF-8 action=%=actionName%

2- i used an encoding filter ...

package controller;

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;


public class EncodingFilter implements Filter {

  private String encoding = UTF-8;

  public void doFilter(ServletRequest request,
  ServletResponse response, FilterChain filterChain)
  throws IOException, ServletException {

request.setCharacterEncoding(encoding);
filterChain.doFilter(request, response);
  }

  public void init(FilterConfig filterConfig)
   throws ServletException {
String encodingParam = filterConfig
  .getInitParameter(encoding);
if (encodingParam != null) {
  encoding = encodingParam;
}
  }

  public void destroy() {
// nothing todo
  }
}

and declared it as following in web.xml ...
  ?xml version = '1.0' encoding = 'UTF-8'?

and ..

  filter
  filter-nameEncodingFilter/filter-name 
  filter-classcontroller.EncodingFilter/filter-class 
 init-param
  param-nameencoding/param-name 
  param-valueUTF-8/param-value 
  /init-param
/filter
filter-mapping
  filter-nameEncodingFilter/filter-name 
  url-pattern/*/url-pattern 
/filter-mapping

3- in struts-config ...
  ?xml version=1.0 encoding= UTF-8 ?

and ..
  controller  contentType=text/html; charset=UTF-8 
   
multipartClass=org.apache.struts.upload.CommonsMultipartRequestHandler
nocache=true /

the point is the the characters reaches the action class corectly but when i
save to datbase an retrieve again it's viewed corrupted in the page 

any help please??
  
-- 
View this message in context: 
http://www.nabble.com/struts-request-encoding-to-utf-8-problem-tp15041079p15041079.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: struts request encoding to utf-8 problem

2008-01-23 Thread wessam

i did add   response.setCharacterEncoding(encoding), in EncodingFilter class
but still output corrupted characters in the jsp
:(
i really need to solve this problem as soon as possible .. any help please ?

-- 
View this message in context: 
http://www.nabble.com/struts-request-encoding-to-utf-8-problem-tp15041079p15041950.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]