File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes problem in encoding in the jsp page. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "problem in encoding in the jsp page." Watch "problem in encoding in the jsp page." New topic

problem in encoding in the jsp page.

naresh govindaswmay
Ranch Hand

Joined: Aug 15, 2007
Posts: 90
In this project i am using struts and EJB is the main.This is fully concentrated on dealer and client chat details.From web page itself admin can able to see what dealer and client conversation.when admin given the request to the struts page it directly calls the Action page.Inside the the Action page just I have created the Object of Bean "I have attached the part of code here "
The code is Action page.
InitialContext initialContext=new InitialContext();
Object obj = initialContext.lookup("LHAdminBeanLocal");
LHAdminLHome lhadminlocalHome = (LHAdminLHome)obj;
LHAdminLocal lhlocal = lhadminlocalHome.create();
ArrayList chats = lhlocal.getDealerChat(request.getParameter("dealer"),date.toString());

while call this method it just check the conditation in the databaase ad returns the values in the bean file itself I have attached the code is bean class .
ResultSet rs = stmt.executeQuery(query);
Chat chat = new Chat();
String dealerChatText=rs.getString("ctext");
System.out.println("Delaer Chat Text-->"+dealerChatText);
This is code is struts.

<logic:iterate id="chat" name="ChatContent" >
<tr class='<%= i++%2==1?"tablerow_1":"tablerow_2" %>'>
<td valign='top'><bean:write name="chat" property="clientid" /></td>
<td valign='top'><bean:write name="chat" property="name" /></td>
<td valign='top'><bean:write name="chat" property="clientcompany" /></td>
<td valign='top'><pre><bean:write name="chat" property="chattext" /></pre></td>
<td valign='top'><bean:write name="chat" property="onlinetime" /></td>
<td valign='top'><bean:write name="chat" property="fromip" /></td>

This is the bean code.After getting all the datas from the database the values are stored in the normal java bean class.after that the bean class is stored in the ArrayList. I have given in bold.I have iterate all the things in jsp file itself.Now the problem is my database contains all of arabic and chinese character.while retriving these datas,browser is showing ??? like this.I have checked UTF-8 and all the charse encoding.Please give me the solution I am waiting for this

Thanks and Regards<br />Naresh govindaswamy
vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580
In logic:iterate tag you did not specify any collection to iterate?
I agree. Here's the link:
subject: problem in encoding in the jsp page.
It's not a secret anymore!