jgm jinggm

Greenhorn
+ Follow
since Nov 19, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by jgm jinggm

this is right:
charset = Charset.forName("gb2312");
20 years ago
//use bytebuffer send Chinese whill throw a ioexception.
SocketChannel Channel = null;
StringBuffer m_Buffer = new StringBuffer("中文");
charset = Charset.forName("ISO-8859-1");
encoder = charset.newEncoder();
Channel.write(encoder.encode(CharBuffer.wrap(m_Buffer)));
//this can throw a ioException and message is "Input length = 1"
//what will i do???/
20 years ago
i write a program using nio channel,like this:
server listening client request,accept request and read/write data with client.when server find client close channel,server close the channel and listening continue.
but i found that when server close the channel,the new client can connect the server ,but dont communication with server.Is i donot can close the channel ???
20 years ago
Nonblocking socket client'sprogram like this:
SocketChannel m_oCltChannel = null;
Selector m_oReadSelector = null;
Selector m_oWriteSelector = null;
m_oReadSelector = Selector.open();
m_oWriteSelector = Selector.open();
m_oCltChannel = SocketChannel.open();
m_oCltChannel.configureBlocking(false);
InetSocketAddress isa = new InetSocketAddress(m_sServerHost, m_iPort);
m_oCltChannel.connect(isa);
m_oCltChannel.register(m_oReadSelector,SelectionKey.OP_CONNECT | SelectionKey.OP_READ );
m_oClt.m_oCltChannel.register(m_oWriteSelector,SelectionKey.OP_WRITE );
while(true){
if(m_oReadSelector.select()>0){
Set oReadKeys = m_oReadSelector.selectedKeys();
Iterator i = oReadKeys.iterator();
while(i.hasNext()){
SelectionKey tmp = (SelectionKey)i.next();
i.remove();
if (tmp.isConnectable()){
/*why come here always ???*/
if (((SocketChannel)tmp.channel()).isConnectionPending()){
while(!((SocketChannel)tmp.channel()).finishConnecta(){}
}
if (tmp.isReadable()){
/*why dont come here always ???*/
}
}
}
if(m_oWriteSelector.select()>0){
Set oWriteKeys = m_oWriteSelector.selectedKeys();
Iterator i = oWriteKeys.iterator();
while(i.hasNext()){
SelectionKey tmp = (SelectionKey)i.next();
i.remove();
if (tmp.isWriteable()){
/*why dont come here always ???*/
}
}
}
}
if i use blocking socket, this while do well work .what happend???
20 years ago
Nonblocking socket client'sprogram like this:
SocketChannel m_oCltChannel = null;
Selector m_oReadSelector = null;
Selector m_oWriteSelector = null;
m_oReadSelector = Selector.open();
m_oWriteSelector = Selector.open();
m_oCltChannel = SocketChannel.open();

m_oCltChannel.configureBlocking(false);
InetSocketAddress isa = new InetSocketAddress(m_sServerHost, m_iPort);
m_oCltChannel.connect(isa);
m_oCltChannel.register(m_oReadSelector,SelectionKey.OP_CONNECT | SelectionKey.OP_READ );
m_oClt.m_oCltChannel.register(m_oWriteSelector,SelectionKey.OP_WRITE );
while(true){
if(m_oReadSelector.select()>0){
Set oReadKeys = m_oReadSelector.selectedKeys();
Iterator i = oReadKeys.iterator();
while(i.hasNext()){
SelectionKey tmp = (SelectionKey)i.next();
i.remove();
if (tmp.isConnectable()){
/*why come here always ???*/
if (((SocketChannel)tmp.channel()).isConnectionPending()){
while(!((SocketChannel)tmp.channel()).finishConnecta(){}
}
if (tmp.isReadable()){
/*why dont come here always ???*/
}

}
}
if(m_oWriteSelector.select()>0){
Set oWriteKeys = m_oWriteSelector.selectedKeys();
Iterator i = oWriteKeys.iterator();
while(i.hasNext()){
SelectionKey tmp = (SelectionKey)i.next();
i.remove();
if (tmp.isWriteable()){
/*why dont come here always ???*/
}
}
}
}
if i use blocking socket, this while do well work .what happend???
yes! thank you very much.
it need pakage!!!
20 years ago
JSP
no package!!
C:\bea\weblogic81\server\bin\applications\aaaa
is my webapplication directory !!
20 years ago
JSP
i am working at bea weblogic8.1 and jdk141_03.
i work in weblogic's sigle-server development environment.
directory as follow:
C:\bea\weblogic81\server\bin\applications\aaaa\WEB-INF\classes\BAS.class
C:\bea\weblogic81\server\bin\applications\aaaa\index.jsp
jsp as follow:
<%@ page language="java" contentType="text/html;charset=gb2312"%>
<jsp:useBean id="ass" scope="session" class="BAS" />
<html>
this is test
</html>
BAS.java as follow:
import java.io.*;
public class BAS {
private int Count;
public BAS(){
Count = 0;
}
public int getCount(){
Count++;
return Count;
}
}
Full compiler error(s):
C:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver__appsdir_aaaa_dir_aaaa\jsp_servlet\__index.java:122: cannot resolve symbol
symbol : class BAS
location: class jsp_servlet.__index
BAS ass = null; //[ /index.jsp; Line: 2]
^
C:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver__appsdir_aaaa_dir_aaaa\jsp_servlet\__index.java:123: cannot resolve symbol
symbol : class BAS
location: class jsp_servlet.__index
ass = (BAS)session.getAttribute("ass"); //[ /index.jsp; Line: 2]
^
C:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver__appsdir_aaaa_dir_aaaa\jsp_servlet\__index.java:126: cannot resolve symbol
symbol : class BAS
location: class jsp_servlet.__index
ass = (BAS)session.getAttribute("ass"); //[ /index.jsp; Line: 2]
^
C:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver__appsdir_aaaa_dir_aaaa\jsp_servlet\__index.java:128: cannot resolve symbol
symbol : class BAS
location: class jsp_servlet.__index
ass = new BAS(); //[ /index.jsp; Line: 2]
20 years ago
JSP