Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in encoding in the jsp page.

 
naresh govindaswmay
Ranch Hand
Posts: 90
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai.
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);
while(rs.next())
{
Chat chat = new Chat();
chat.setClientid(rs.getString("cid"));
chat.setDealername(dealername);
chat.setName(rs.getString("cname"));
chat.setClientcompany(rs.getString("company"));
String dealerChatText=rs.getString("ctext");
dealerChatText=HTMLEncode.encode(dealerChatText);
System.out.println("Delaer Chat Text-->"+dealerChatText);
chat.setChattext(dealerChatText);
chat.setLogintime(rs.getString("logintime"));
chat.setOnlinetime(rs.getString("onlinefor"));
chat.setFromip(rs.getString("fromip"));
chats.add(chat);
}
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>
</tr>
</logic:iterate>

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
 
vidya sagar
Ranch Hand
Posts: 580
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In logic:iterate tag you did not specify any collection to iterate?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic