2014年5月27日星期二

Help , why add another panel after listening to the keyboarduseless ?

I learn how to make the Snake game , when the control panel and without explanation panels, game panel buttons change according to the direction of the snake :
public class MainFrame {

public static void main(String[] args) {
// TODO 自动生成的方法存根
GamePanel gamePanel = new GamePanel();
OptionsPanel optionsPanel = new OptionsPanel();
JPanel infoPanel = new InfoPanel();
Snake snake = new Snake();
Food food = new Food();
Ground ground = new Ground();
Controller controller = new Controller(
snake, food, ground, gamePanel);

JFrame jf = new JFrame();
jf.setTitle("HQS贪吃蛇");

//不使用布局管理器!运用绝对布局!
jf.setLayout(null);
jf.setResizable(false);
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jf.setSize(Global.WIDTH * Global.CELL_SIZE + 20
, Global.HEIGHT * Global.CELL_SIZE + 250);
gamePanel.setSize(Global.WIDTH * Global.CELL_SIZE
, Global.HEIGHT * Global.CELL_SIZE);
gamePanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED));

//添加游戏面板
gamePanel.setBounds(5, 10, Global.WIDTH * Global.CELL_SIZE
, Global.HEIGHT * Global.CELL_SIZE);
jf.getContentPane().add(gamePanel);

//添加控制面板
/*optionsPanel.setBounds(5, 415, 460, 200);
jf.getContentPane().add(optionsPanel);

//添加说明面板
infoPanel.setBounds(470, 415, 235, 200);
jf.getContentPane().add(infoPanel);
*/
gamePanel.addKeyListener(controller);
snake.addSnakeListener(controller);
jf.addKeyListener(controller);

jf.setVisible(true);
controller.newGame();
System.out.println("After running!");
}

}After running!");
}

}



but the control panel and the rear panel plus instructions , keyboard sniffers useless. Key smugglers did not respond !



This is the listener class :
public class Controller extends KeyAdapter implements SnakeListener {

private Snake snake;
private Food food;
private Ground ground;
private GamePanel gamePanel;

public Controller(Snake snake, Food food, Ground ground, GamePanel gamePanel) {
super();
this.snake = snake;
this.food = food;
this.ground = ground;
this.gamePanel = gamePanel;
}
public void keyPressed(KeyEvent e) {
// TODO 自动生成的方法存根
super.keyPressed(e);

System.out.println("key press~!");
//根据键盘按键,来改变方向
switch(e.getKeyCode()){
case KeyEvent.VK_UP:
System.out.println("UP");
snake.changeDirection(Snake.UP);
break;
case KeyEvent.VK_DOWN:
System.out.println("DOWN");
snake.changeDirection(Snake.DOWN);
break;
case KeyEvent.VK_LEFT:
System.out.println("LEFT");
snake.changeDirection(Snake.LEFT);
break;
case KeyEvent.VK_RIGHT:
System.out.println("RIGHT");
snake.changeDirection(Snake.RIGHT);
break;
default:
System.out.println("null");
break;
}
}
@Override
public void SnakeMove(Snake snake) {
// TODO 自动生成的方法存根

if(food.isEatFood(snake)){
snake.eatFood();
food.newFood(ground.getPoint());
}

if(ground.isSnakeEatRock(snake)){
snake.die(false);
}

if(snake.isEatBody()){
snake.die(false);
}
gamePanel.dispaly(snake, food, ground);
}

public void newGame(){
snake.start();
food.newFood(ground.getPoint());
}
}

help it, this is where the problem is !
------ Solution ---------------------------------------- ----
JComponent and its subclasses have a grabFocus (), you try

------ For reference only ---------------------------------- -----
to set the display image components are always active.
------ For reference only -------------------------------------- -
or listen on you most of the top-level container inside
------ For reference only ----------------------- ----------------

Thank However , JFrame not a top-level container it? "Jf.addKeyListener (controller);" should be added to the top of the container , right ?
------ For reference only -------------------------------------- -

how to make components always active ?
------ For reference only -------------------------------------- -
online help, nobody ah
------ For reference only ---------------------------- -----------
Thank you, has been resolved, because there was no let gamePanel component settings to get the focus method "this.setFocusable (true);".

like the eclipse and command line parameters , why not generateeclipse heap Transfer files quickly move

I press "in-depth understanding of JAVA virtual machine" program hit 2.3 code
configuration parameters in eclipse invisible dump out tips , find wing





------ Solution --------------------------------------------
input to the following the VM parameters box
------ Solution ---------------------------------- ----------

misplaced it !
into the VM arguments in a try !
------ For reference only -------------------------------------- -
push
--- --- For reference only ---------------------------------------






I later learned the wrong , even evil CSDN Search " my post " does not even check out this post , so I can not shut

Those doubts constructor (compiler is not the case according to theparameters ...)

compiler is not the case according to the parameters , choose to call the constructor it? Not the first SubClass (), and then call the parent class constructor SuperClass (int n) do, how it will be given in line 19 (off SuperClass () what happened ) ?


------ Solution ------- -------------------------------------

  
method is not invoked only when implemented? Throughout the implementation process of the compiler , it is not related to SubClass (int n) ( do not call it off ) , how will the compiler do not go , there will be an error it?  
Who does not relate to ?
when the compiler generates bytecode files would be logical for the code inside other tests , whether you run do not run , you do not have a default constructor of the parent class , another subclass constructor , the compiler I will try to find the parent class , but can not find the natural error.

In other words , if there is such an error , the compiler never mind , then the programmer will miss much wrong?
------ For reference only ---------------------------------------
pass parameters when instantiating a ?
------ For reference only -------------------------------------- -
right in the place where you draw the red frame , wrong on SubClass (int) method of this structure . No parent class constructor with no arguments
------ For reference only ------------------------------- --------


method is not invoked only when implemented? Throughout the implementation process of the compiler , it is not related to SubClass (int n) ( do not call it off ) , how will the compiler do not go , there will be an error it?
------ For reference only -------------------------------------- -
learn, cattle mighty
------ For reference only ----------------------------- ----------
unless you are allowed to use the no-argument constructor
otherwise constructor with no arguments will be written on the
is to prevent subclasses appear to find less than a no-argument constructor of the parent class

2014年5月26日星期一

About mysql connection with java , cmd run error problem


Because do not understand this , so please answer can be as detailed as possible , in this thank you, also please the great God who mouth mercy , God knows we are all big ask to come , and Baidu inside too promiscuous , thank you < br> ------ Solution ----------------------------------------- ---
first should be, grammatical errors , call a stored procedure studentscore.addstudent, but does not exist.
The second is a primary key value 201,201,010 repeated ,
------ For reference only ----------------------- ----------------
agree on the first floor , the landlord read English can understand its meaning.
------ For reference only ----- ----------------------------------
er er, right , thank you, thanks!
------ For reference only -------------------------------------- -
this how to sub- ah , the amount

An error checking does not come out ! Daniel seeking help !

Can anyone help me find the phrase java code of SQL What is the problem :
String sql = "SELECT tradeId, t.cardNo, tradeType, tradeAmount, targetCard, poundage, tradeTime, acceptBankID, atmNo ; FROM Trade t JOIN BankCard b on t.cardNo = b.cardNo JOIN Customer c on b.custId = c.custId WHERE name = ? " ;
perform to get the right results in the database , put java code to die !
error message:
java.sql.SQLException: com.microsoft.sqlserver.jdbc.SQLServerException: column name 'name' is not valid. Query: SELECT tradeId, t.cardNo, tradeType, tradeAmount, targetCard, poundage, tradeTime, acceptBankID, atmNo FROM Trade t JOIN BankCard b on t.cardNo = b.cardNo JOIN Customer c on b.custId = c.custId WHERE name =? Parameters: [ruirui]
at org.apache.commons.dbutils.AbstractQueryRunner.rethrow (AbstractQueryRunner.java: 363)
at org.apache.commons.dbutils.QueryRunner.query (QueryRunner.java: 350)
at org.apache.commons.dbutils.QueryRunner.query (QueryRunner.java: 211)
at com.javaweb.bank.dao.impl.BaseDAO.queryForList (BaseDAO.java: 123)
at com.javaweb.bank.test.TradeDAOImplTest.testGetTradesWithName (TradeDAOImplTest.java: 61)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java: 39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java: 25)
at java.lang.reflect.Method.invoke (Method.java: 597)
at org.junit.runners.model.FrameworkMethod $ 1.runReflectiveCall (FrameworkMethod.java: 44)
at org.junit.internal.runners.model.ReflectiveCallable.run (ReflectiveCallable.java: 15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively (FrameworkMethod.java: 41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate (InvokeMethod.java: 20)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored (BlockJUnit4ClassRunner.java: 79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild (BlockJUnit4ClassRunner.java: 71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild (BlockJUnit4ClassRunner.java: 49)
at org.junit.runners.ParentRunner $ 3.run (ParentRunner.java: 193)
at org.junit.runners.ParentRunner $ 1.schedule (ParentRunner.java: 52)
at org.junit.runners.ParentRunner.runChildren (ParentRunner.java: 191)
at org.junit.runners.ParentRunner.access $ 000 (ParentRunner.java: 42)
at org.junit.runners.ParentRunner $ 2.evaluate (ParentRunner.java: 184)
at org.junit.runners.ParentRunner.run (ParentRunner.java: 236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (JUnit4TestReference.java: 50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run (TestExecution.java: 38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (RemoteTestRunner.java: 467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (RemoteTestRunner.java: 683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (RemoteTestRunner.java: 390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (RemoteTestRunner.java: 197)

------ Solution ------------------------------------ --------
try specify the name of the table name.
------ Solution ---------------------------------------- ----
.. try to write the Customer table in the back From now
------ For reference only -------------------- -------------------

how nobody . . . . . .
------ For reference only -------------------------------------- -
is that right :
String sql = "SELECT tradeId, t.cardNo, tradeType, tradeAmount, targetCard, poundage, tradeTime, acceptBankID, atmNo ; FROM Trade t JOIN BankCard b on t.cardNo = b.cardNo JOIN Customer c on b.custId = c.custId WHERE c.name ; = " ? ;

still useless :
java.sql.SQLException: com.microsoft.sqlserver.jdbc.SQLServerException: Unable to bind multi-part identifier "c.name". Query: SELECT tradeId, t.cardNo, tradeType, tradeAmount, targetCard, poundage, tradeTime, acceptBankID, atmNo FROM Trade t JOIN BankCard b on t.cardNo = b.cardNo JOIN Customer c on b.custId = c.custId WHERE c.name =? Parameters: [ruirui]
at org.apache.commons.dbutils.AbstractQueryRunner.rethrow (AbstractQueryRunner.java: 363)
at org.apache.commons.dbutils.QueryRunner.query (QueryRunner.java: 350)
at org.apache.commons.dbutils.QueryRunner.query (QueryRunner.java: 211)
at com.javaweb.bank.dao.impl.BaseDAO.queryForList (BaseDAO.java: 123)
at com.javaweb.bank.test.TradeDAOImplTest.testGetTradesWithName (TradeDAOImplTest.java: 61)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java: 39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java: 25)
at java.lang.reflect.Method.invoke (Method.java: 597)
at org.junit.runners.model.FrameworkMethod $ 1.runReflectiveCall (FrameworkMethod.java: 44)
at org.junit.internal.runners.model.ReflectiveCallable.run (ReflectiveCallable.java: 15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively (FrameworkMethod.java: 41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate (InvokeMethod.java: 20)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored (BlockJUnit4ClassRunner.java: 79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild (BlockJUnit4ClassRunner.java: 71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild (BlockJUnit4ClassRunner.java: 49)
at org.junit.runners.ParentRunner $ 3.run (ParentRunner.java: 193)
at org.junit.runners.ParentRunner $ 1.schedule (ParentRunner.java: 52)
at org.junit.runners.ParentRunner.runChildren (ParentRunner.java: 191)
at org.junit.runners.ParentRunner.access $ 000 (ParentRunner.java: 42)
at org.junit.runners.ParentRunner $ 2.evaluate (ParentRunner.java: 184)
at org.junit.runners.ParentRunner.run (ParentRunner.java: 236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (JUnit4TestReference.java: 50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run (TestExecution.java: 38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (RemoteTestRunner.java: 467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (RemoteTestRunner.java: 683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (RemoteTestRunner.java: 390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (RemoteTestRunner.java: 197)
------ For reference only ---------- -----------------------------
sincerely thank you ! This really is the answer ! How is this going ? !

Beijing side AsiaInfo how?

yesterday to AsiaInfo-Linkage ( Beijing ) interview a little java development on the interview , so years after entry , talk about salary , saying it was band7, 13 months , while in April there is a bonus. I do not know this side of Beijing AsiaInfo how, please help explain , thank you ah.
------ Solution ---------------------------------------- ----
band7 is how much money
------ Solution ----------------------------- ---------------
unclear Bangding .
------ Solution ---------------------------------------- ----
Oh passing , that department interview
------ Solution -------------------------- ------------------
Yalian good money this treatment is also good in the traditional telecommunications industry, AsiaInfo has a monopoly is not busy working you have to maintain the old system, the development of new features may be a long business trip , of course I am talking about the situation in Nanjing Yalian
------ Solution ---------- ----------------------------------
lz is 211,985 ? go to this price good < br> ------ Solution ----------------------------------------- ---
not Zeyang Nanjing , Beijing does not know
------ Solution ------------------------ --------------------
seeking interview experience , immediately go to the interview . . .
------ Solution ---------------------------------------- ----
currently I am doing is Huawei's telecommunications outsourcing , who can offer them the opportunity to jump AsiaInfo
grateful

------ Solution - -------------------------------------------

------ Solution ----- ---------------------------------------
you ask students if more than 5 years experience , biphenylene give what level , how much money to give Oh ?
------ Solution ---------------------------------------- ----

lack of people in our department Yeah , do not want to come
------ Solution - -------------------------------------------
AsiaInfo sales post how? Salary and job stress intensity how? Just received an interview . . . Under girls , pointing yo have to know , thank you !
------ For reference only -------------------------------------- -
no one know? Please know that the situation of the brothers gets advice ah, grateful.
------ For reference only ---------------------------------------

3 years experience , 11k, just do not know how ah company , formerly also doing the project on the company spent 2.5 years
------ For reference only ------------ ---------------------------

ashamed , learning has been bad , third undergraduate background
--- --- For reference only ---------------------------------------

From the inside, my department and you say that the reference is not much, busy, will travel, because of family problems, and can not travel often, so put this job to reject the
----- - For reference only ---------------------------------------
LZ is the face which department I also received a offer, uninformed , please tell
------ For reference only ------------------- --------------------



seeking an interview after , whether written ?
------ For reference only -------------------------------------- -

  
  
seeking an interview after , whether written ?  

first written after the interview , written test is very simple, those common interview questions , but many would question the amount , so that the last bit sick , I will not do it, then the interview , the interview is to talk about some of the technology, what spring, hibernate underlying principle , aop, di, some basic techniques are also loaded B asked a few large data ah whatever, the main thing is you do these projects . Basically is not difficult .
------ For reference only -------------------------------------- -

years after they are hiring, job posting should have it
------ For reference only ------------------ ---------------------
from where you can see the recruitment information? The official website of it?
------ For reference only -------------------------------------- -

years after they are hiring, it should have a job posting  
Where can I see the recruitment information? The official website of it?
------ For reference only -------------------------------------- -

years after they are hiring, it should have a job posting          
Where can I see the recruitment information? The official website of it?  
seemed Oh, you search under
------ For reference only on 51JOB ------------------------- --------------

chewing should be b8-b10, money Well, can not know , the more you want it to be and more , but also consider the entire annual salary , the company feels very formal, all good
------ For reference only --------------------------- ------------

------ For reference only ---------------------------------- -----

    
Mobile BI         
------ For reference only ---------------------------------- -----


landlord , ask, which department you face , ? Talk about salary when he told you to do it?
I also went to the interview tomorrow to talk about salary , in considering whether to go up ? Give qq it? Maybe after a colleague of it
------ For reference only ------------------------------- --------
written to make a mess , nausea , and estimated hung up. . .
------ For reference only -------------------------------------- -

      
Mobile BI                
in which city do , do overtime , how the treatment ?         
------ For reference only ---------------------------------- -----

      
Mobile BI                
    
    
can engage in a Kazakhstan         
------ For reference only ---------------------------------- -----

        
Mobile BI                      
in which city do , do overtime , how the treatment ?                
Beijing , rarely work overtime , unless the project met on-line . AsiaInfo treatment on the middle of it , but also the ability to     
        
------ For reference only ---------------------------------- -----

        
Mobile BI                      
      
      
can engage in a Kazakhstan                
can come and try ah , here we are lack of people do     
        
------ For reference only ---------------------------------- -----

What are some topics written ah, just received a " maintenance engineer" interview , seeking experience oh !
------ For reference only -------------------------------------- -
today to AsiaInfo interview , big data analysis, do not know how to respect the CICA , before there is no similar project , can not do it
------ For reference only --- ------------------------------------
I am also a big interview data division, June In the past, the development of interns do not know what knowledge it
------ For reference only to learn in advance ----------------------- ----------------


intern candidates you have written to ask what the main interview

------ For reference only ---------------------------------- -----

What are some topics written ah, just received a " maintenance engineer" interview , seeking experience oh !  


what is the operation and maintenance , ah, operation and maintenance of the system or database maintenance ?
------ For reference only -------------------------------------- -

3 years experience , 11k, just do not know how this company ah , formerly also doing the project on the company spent 2.5 years  

you this 11K is included CITG it? ? That he did not count on you this subsidy in the 11K ?

Why timer is not enforced? Thank you :)

code is as follows :
public class TestTimer {
public void showTimer () {
TimerTask task = new TimerTask () {
@ Override
public void run () {
System.out.println (" executed " ) ;
}
};
Calendar calendar = Calendar.getInstance ();
int year = calendar.get (Calendar.YEAR);
int month = calendar.get (Calendar.MONTH) + 1;
int day = calendar.get (Calendar.DAY_OF_MONTH);
calendar.set (year, month, day, 13, 22, 0);
Date date = calendar.getTime ();
Timer timer = new Timer (true);
timer.schedule (task, date);
}
}


MainForm.Java
public class MainForm extends JFrame {
TestTimer m_Timer = new TestTimer ();
public MainForm () {
.......
m_Timer.showTimer ();
}
.......
}

Thank you
------ Solution ---------------------------------- ----------
int month = calendar.get (Calendar.MONTH) + 1;
you regard the time fixed in the next month, how will immediately see the results . .
------ For reference only -------------------------------------- -
nobody knows yet
------ For reference only ------------------------------ ---------
Thank you :) ..............
------ For reference only --------- ------------------------------
tangled it

I have a good job shiro, after successful login, how to get user information in jsp page ?

I added shiro in the project, are equipped with a good

this time from the login page login, login is certified by shiro , shiro that the user's information is stored where were we? How do I get in jsp page ?

Or login authentication , if the login is successful , I have to manually save a current user object in the session ?
------ Solution ---------------------------------------- ----
can do that, the user information stored encrypted in the session
------ Solution --------------------- -----------------------
not used, but nothing more than a few ways to verify the safety , request.getRemoteUser (), request. getUserPrincipal () getName ();.

List <Map <String, int[]>> array adding

 This post last edited by lilewy on 2014-05-25 10:32:26
int [] num1 = {1,2,3,4,5,6};
int [] num2 = {7,8,9,10,11,12};
int [] num3 = {13,14,15,16,17,18};
int [] num4 = {19,20,21,22,23,24};

Map map0 = new HashMap ();
map0.put ("d", num1);
map0.put ("c", num2);
map0.put ("b", num3);
map0.put ("a", num4);
Map map1 = new HashMap ();
map1.put ("d", num1);
map1.put ("c", num2);
map1.put ("b", num3);
map1.put ("a", num4);

List > infoIds = new ArrayList > ();
infoIds.add (map0);
infoIds.add (map1);


think the result is
map0 with the same key adding map1
If the sum is a 38,40,42,44,46,48
b ...., c ...., d ......
return the new Map object
------ Solution ------------------- -------------------------
		int[] num1 = { 1, 2, 3, 4, 5, 6 };
int[] num2 = { 7, 8, 9, 10, 11, 12 };
int[] num3 = { 13, 14, 15, 16, 17, 18 };
int[] num4 = { 19, 20, 21, 22, 23, 24 };

Map<String, int[]> map0 = new HashMap<String, int[]>();
map0.put("d", num1);
map0.put("c", num2);
map0.put("b", num3);
map0.put("a", num4);

Map<String, int[]> map1 = new HashMap<String, int[]>();
map1.put("d", num1);
map1.put("c", num2);
map1.put("b", num3);
map1.put("a", num4);

Map<String, int[]> map2 = new HashMap<String, int[]>();
map2.put("d", num1);
map2.put("c", num2);
map2.put("b", num3);
map2.put("a", num4);

List<Map<String, int[]>> infoIds = new ArrayList<Map<String, int[]>>();
infoIds.add(map0);
infoIds.add(map1);
infoIds.add(map2);

// 需要返回的map对象
Map<String, int[]> newMap = new HashMap<String, int[]>();

Set<String> keys = infoIds.get(0).keySet();
// 遍历map,将其中数组与别一个map相加
for (String key : keys)
{
//新数组
int[] newArr = new int[infoIds.get(0).get(key).length];

//遍历list中的map
for (Map<String, int[]> map : infoIds)
{
int[] array = map.get(key);
for (int i = 0; i < array.length; i++)
{
newArr[i] += array[i];
}
}

newMap.put(key, newArr);
}

System.out.println(newMap.get("a")[0]);

------ For reference only ------- --------------------------------
I'm here with map1 considered map0 the key are the same, and the corresponding key in the array is the same situation
		int[] num1 = { 1, 2, 3, 4, 5, 6 };
int[] num2 = { 7, 8, 9, 10, 11, 12 };
int[] num3 = { 13, 14, 15, 16, 17, 18 };
int[] num4 = { 19, 20, 21, 22, 23, 24 };

Map<String, int[]> map0 = new HashMap<String, int[]>();
map0.put("d", num1);
map0.put("c", num2);
map0.put("b", num3);
map0.put("a", num4);

Map<String, int[]> map1 = new HashMap<String, int[]>();
map1.put("d", num1);
map1.put("c", num2);
map1.put("b", num3);
map1.put("a", num4);

//需要返回的map对象
Map<String, int[]> newMap = new HashMap<String, int[]>();

//遍历map,将其中数组与别一个map相加
Set<String> keys = map0.keySet();
for (String key : keys)
{
int[] array0 = map0.get(key);
int[] array1 = map1.get(key);
int[] newArray = new int[array0.length];
for (int i = 0, len = array0.length; i < len; i++)
{
newArray[i] = array0[i] + array1[i];
}
//将相加后的数组存入新map中
newMap.put(key, newArray);
}

System.out.println(newMap.get("a")[0]);

------ For reference only ----------------------------------- ----


I want to remove the data from the List > infoIds, trouble and then improve the next .
------ For reference only -------------------------------------- -
Map NewMap = new HashMap ();
for (Map maptemp: infoIds) {
Map map = new HashMap ; ( ) ;
for (Map.Entry entry: ; maptemp.entrySet ()) {
String key = entry.getKey ();
int [] value = entry.getValue ( ) ;
if (map.containsKey (key)) {
int [] num = {};
for (int i = 0; i num = new int [value.length];
num [i] = map.get (key) [i] + value [i];
}
map.put (key, num);
} else {
map.put (key, value);
}
}
System.out.println ("----");
System.out.println (" summed up :" + map.get ("a") [0] + "," ; + map.get ("a") [1] + "," + map.get ("a") [2] + "," + map.get ("a") [ 3] + "," + map.get ("a") [4] + "," + map.get ("a") [5]);
NewMap = map;
}
for (int a: NewMap.get ("a")) {
System.out.println (a + ",");
}
leave himself wrote for the collection. Thanks for the reply to the points.

Consult written a sql statement , seeking Great God enlighten. Thank you , Online

now have a table GWSJ_YDLKJH, there is such a place "DD", the value of which he kept a " 432.2-435.6 " " 123.23-343.00 ", "1 #, 2 # ," and other types of characters
only in the above two types of data , there is only one intermediate array " - " and now I want the data in accordance with the " 123.23-343.00 " " 432.2-435.6 ", "1 #, 2 #" this sort of way , that put together the digital type , in accordance with the " - " in front of small to large numbers , followed by a # type into the back , so that how to write a sql statement , seeking great God enlighten. Thank you , Online
------ Solution ------------------------------------ --------

select * from (select * from test_order where dd like '%-%' order by dd) a
union 
select * from (select * from test_order where dd like '%#%' order by dd) b

------ Solution -------------------------- ------------------
What is your database ? sql area to ask it , there more professional
------ Solution ------------------------ --------------------
MySQL can do:
select * from GWSJ_YDLKJH order by instr (DD, '-') = 0, DD;
------ For reference only -------- -------------------------------
on upstairs union should be able to
---- - For reference only ---------------------------------------
2 floor can be
------ For reference only ----------------------------------- ---- wording
each database is not the same , if it is , then the second floor oracle can
------ For reference only ---------------------------------------
thank above . . .

------ For reference only ---------------------------------- -----

this seems not right , oracle database
------ For reference only ------------------ ---------------------
select to_number(substr(dd, 0, instr(t.dd, '-') - 1))as lc
  from GWSJ_YDLKJH t
 order by lc asc


everyone to see me this has not been optimized for
------ For reference only ------------------------- --------------
passing learn
------ For reference only ---------------------------------------
passing learn ! !

java can not generate a result set is empty , scrollable result sets generated problems

public ResultSet executeQuery () throws SQLException {
String sql = "select YHID from YH_INFO where YHID =?";
prepStmt = conn.prepareStatement (sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
prepStmt.setString (1, "zz");
ResultSet rs = prepStmt.executeQuery ();
prepStmt.close ();
return rs;
}
resultset should have results may resultSet is empty


connected oracle 10g, the driver is class12, ojdbc14. scored by the connection pool
------ Solution ------------------- -------------------------
prepStmt.close (); removed.
------ For reference only -------------------------------------- -
break point with it, or the sql statement out, ran into plsql in it, look at the results .
see the value of sql statement not check out , or call the java code problem.

Help cannot be resolved to a variable

 This post last edited by int_java_se on 2014-05-25 18:49:33
public class Encapsulation
{
public int add (int a, int b)
{
return a + b;
}
public int subtract (int a, int b)
{
return a - b;
}
public int multiplication (int a, int b)
{
return a * b;
}
public int division (int a, int b)
{
return a / b;
}
public void sop () / / here is no need to return , the variable name must be familiar with the following variable names are case unity.
{
System.out.println ("hello word");
}
public void returnTest (int x)
{
for (int f = 1; f <10; f + +)
{
if (9 == f)
{
System.out.println (x + "=" + f);
}
}
System.out.println (x);
}
public static void main (String [] args)
{
Encapsulation test = new Encapsulation ();
int a = 8;
int b = 4;
int i = test.add (a, b) ;/ / method calls need to be completed by the object , the method call in the form of : object variable method name ( [ parameter 1 , parameter 2 , parameter 3 .... ) ;
int i1 = test.subtract (a, b);
int i2 = test.multiplication (a, b);
int i3 = test.division (a, b);
System.out.println (i);
System.out.println (i1);
System.out.println (i2);
System.out.println (i3);
test.sop ();
testreturnTest (x); / / error of x cannot be resolved to a variable Editor's Note it

}
}
------ Solution ----------------------------------- ---------
testreturnTest(x); 

What's this ?
1, x is not defined .
2, testreturnTest what stuff .
------ Solution ---------------------------------------- ----
you do not define the variable x course not , public void returnTest previously defined (int x) {} where x is only reurnTest () function in Useful
------ For reference only ------------------------------------- -
X variable , you define where ? ?
------ For reference only -------------------------------------- -
I only declare int is not assigned .
------ For reference only -------------------------------------- -
x?
------ For reference only ---------------------- -----------------
x lie ? landlord or call the compiler about Caesar , x you are passed as arguments , you do not define x, you dare pass ?
------ For reference only ---------------------------------------
; public void returnTest (int x)
{
for (int f = 1; f <10; f + +)
{
if (9 == f)
{
System.out.println (x + "=" + f);
}
}
System.out.println (x);
}
there any way to get X return out , ah, do not define you?
------ For reference only -------------------------------------- -
x this variable is not defined that way

JSP: forward solving





sessionfactory injection error, beg master

Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.hibernate.impl.SessionFactoryImpl' to required type ; 'org.hibernate.SessionFactory' for property 'sessionFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.hibernate.impl . SessionFactoryImpl] to required type [org.hibernate.SessionFactory] for property 'sessionFactory': no ​​matching editors or conversion strategy found
applicationContet.xml

<-! root element of the Spring configuration file , use spring-beans-3.0.xsd semantic constraints - >
xmlns = "http://www.springframework.org/schema/beans"
xsi: schemaLocation = "http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd ">


<-! define a business logic components , to achieve class MyServiceImp ->
class = "org.crazyit.app.service.impl.MyServiceImpl">

<-! defined data source Bean, using C3P0 data source implementation - >
destroy-method = "close">
<-! Specifies the connection to the database driver - >

<-! URL specified connection to the database - >

<-! user name specified connection to the database - >

<-! Specifies the connection to the database password - >

<-! Specifies the connection to the database connection pool maximum number of connections - >

<-! Specifies the connection to the database connection pool minimum number of connections - >

<-! Specifies the connection to the database connection pool initialization connections - >

<-! Specifies the connection to the database connection pool maximum idle time - >


<-! define the Hibernate SessionFactory ->
class = "org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<-! dependency injection data sources , into precisely defined above dataSource ->

<-! mappingResouces attribute is used to list all the mapping file - >


<-! used to list the following Hibernate mapping file - >
org / crazyit / app / domain / Person.hbm.xml


<-! defined Hibernate SessionFactory properties - >

<-! configure Hibernate Properties - >

hibernate.dialect = org.hibernate.dialect.OracleDialect
hibernate.hbm2ddl.auto = update
hibernate.show_sql = true
hibernate.format_sql = true;






<-! definitions DAO Bean ->
class = "org.crazyit.app.dao.impl.PersonDaoHibernate">
<-! inject persistence required to operate SessionFactory ->






Web.xml

xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi: schemaLocation = "http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd "version =" 3.0 ">
<-! define the Web application home page - >

index.jsp

<-! location profiles Spring configuration file - >

<-! Use ContextLoaderListener to initialize the Spring container - >

org.springframework.web.context.ContextLoaderListener


<-! define Struts FilterDispathcer of Filter 2 's - >

struts2
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter

<-! FilterDispatcher used to initialize Struts 2 and WEB handle all requests . - >

struts2
/ *





------ Solution ------------------------------------ --------

Spring hibernate can manage , plus they reported the wrong Struts  

session factory using this org.hibernate.impl.SessionFactoryImpl look
------ For reference only ------------------ --------------------- did not see what the problem is on
configuration , ah, why should not you realize SessionFactory SessionFactoryImpl ah ?
------ For reference only -------------------------------------- -
look jar package
you use ------ For reference only --------------------------- ------------
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.hibernate. impl.SessionFactoryImpl 'to required type' org.hibernate.SessionFactory 'for property' sessionFactory '; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.hibernate.impl.SessionFactoryImpl] to required type [org.hibernate.SessionFactory] for property 'sessionFactory': no matching editors or conversion strategy found

SessionFactoryImpl can not be converted into org.hibernate.SessionFactory
------ For reference only ------------------- --------------------

antlr-2.7.6.jar, cglib-nodep-2.1_3.jar, com.springsource.org. aopalliance-1.0.0.jar, com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar, commons-collections-3.1.jar, commons-fileupload-1.2.1.jar, commons-io-1.3. 2.jar, commons-logging-api-1.1.jar, dom4j-1.6.1.jar, ejb3-persistence.jar, freemarker-2.3.16.jar, hibernate3.jar, javassist-3.12.0.GA.jar, jta-1.1.jar, ognl-3.0.jar, ojdbc14.jar, org.springframework.aop-3.0.5.RELEASE.jar, org.springframework.asm-3.0.5.RELEASE.jar, org.springframework.beans- 3.0.5.RELEASE.jar, org.springframework.context-3.0.5.RELEASE.jar, org.springframework.core-3.0.5.RELEASE.jar, org.springframework.expression-3.0.5.RELEASE.jar, org.springframework.jdbc-3.0.5.RELEASE.jar, org.springframework.orm-3.0.5.RELEASE.jar, org.springframework.transaction-3.0.5.RELEASE.jar, org.springframework.web-3.0. 5.RELEASE.jar, servlet-api.jar, slf4j-api-1.6.1.jar, slf4j-nop-1.6.1.jar, struts2-core-2.2.1.jar, struts2-spring-plugin-2.2. 1.jar, xwork-core-2.2.1.jar
------ For reference only ------------------------- --------------

just inherited HibernateDaoSupport, injecting sessionFactory they reported this wrong, very strange, configured to check for a long time did not find how can the problem
------ For reference only --------------------------------------- < br> http://docs.spring.io/spring/docs/2.5.x/api/org/springframework/orm/hibernate3/support/HibernateDaoSupport.html

You can look api declaration must be injected org.hibernate.SessionFactory

------ For reference only ---------------------------------- -----
org.springframework.orm.hibernate3
Class LocalSessionFactoryBean

java.lang.Object
extended by org.springframework.orm.hibernate3.AbstractSessionFactoryBean
extended by org.springframework.orm.hibernate3.LocalSessionFactoryBean
All Implemented Interfaces:
BeanClassLoaderAware, DisposableBean, FactoryBean, InitializingBean, PersistenceExceptionTranslator
Direct Known Subclasses:
AnnotationSessionFactoryBean



little relationship with org.hibernate.SessionFactory destroy both have
------ For reference only ---------------------- -----------------
so either modify the DAO parent , or another sessionfactory
------ For reference only --- ------------------------------------

Spring can manage hibernate , plus Struts they reported on the wrong
------ For reference only ------------------------------- What --------
final solution is ? brother have encountered such a problem. Solving .

About BufferedInputStream and BufferedOutputStream problems

public class Copypicture {
public static void main(String[] args) {
copy_2();//copy_1();
}
public static void copy_1(){
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream("1.doc");
fos = new FileOutputStream("2.doc");
byte[] buff = new byte[1024];
int len = 0;
while((len=fis.read(buff))!=-1){
//System.out.println(len);
fos.write(buff,0,len);
}
System.out.println("success!");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
fis.close();
fos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public static void copy_2(){
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
//int i = 0;
try {
bis = new BufferedInputStream(new FileInputStream("1.doc"));
bos = new BufferedOutputStream(new FileOutputStream("2.doc"));
//byte[] buff = new byte[1024];
int len = 0;
while((len=bis.read())!=-1){//return getBufIfOpen()[pos++] & 0xff;
//System.out.println(i++);
bos.write(len);//文件有多字节就写多少次
}
System.out.println("success!");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
bis.close();
bos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
}

The question is:
copy_1 () method and copy_2 () method What is the difference ? My understanding is that copy_1 () method is the size of 1024 bytes read from a text file into memory 1.doc then peremptorily write 2.doc, while copy_2 () method is to read 1024 bytes in size text into memory , then a byte by byte written to 2.doc in , is that right ? But if so, then this defines BufferedOutputStream doing, but low efficiency is not it?
------ Solution ---------------------------------------- ----
BufferedInputStream buffered input stream. It inherits FilterInputStream.
BufferedInputStream role is to add some functionality to another input stream , for example , provide a " buffering " and support for "mark () marks " and "reset () Reset method ."
BufferedInputStream essentially an internal buffer array implementation. For example, after a new input stream corresponding BufferedInputStream, when we read the data input stream by the read (), BufferedInputStream the input data stream will fill the buffer in a batch . Every time after the data buffer is read , the input stream will once again fill the data buffer ; and so forth, until we read the position of the input data stream .

copy_1 similar BufferedInputStream buff comes in buffer , copy_2 the buff that one has commented out , BufferedInputStream default buffer is 8192 bytes , regardless copy_1 in the buff, and comes with a buffer BufferedInputStream are designed to improve efficiency , as the high efficiency of the two who , know this to be tested

------ Solution ------------------------------------ --------
copy_2 you should look at is the FileInputStream BufferedInputStream wrapped up in the read (byte b [], int off, int ; len) is called many times
------ Solution ------------------------------- -------------
you such great quantities , there is no difference . But little loss .
BufferedInputStream commissioned mode.

general is read (byte b [], int off, int len), read a little , analyze , read a little .
------ Solution ---------------------------------------- ----
insight worth learning. . . mark
------ Solution --------------------------------------- -----
how many bytes to read their own control , or it may cause memory overflow

read (byte b [], int off, int len), 1024 bytes each read , write , and read again
------ For reference only ---------------------------------------
but I tested ah , copy_1 the while loop fos.write (buff, 0, len) this is OK as long as the execution of dozens , while the copy-2 of the while loop is written byte by byte , you need tens of thousands of times `` `` ` Why is this ? Since there BufferedInputStream, should not be like that in copy_1 implemented?
------ For reference only -------------------------------------- -
their top their top
------ For reference only ---------------------------- -----------

did not understand , the more points you can say /
------ For reference only ---------- -----------------------------
one is : fos.write (buff, 0, len);
Another is : bos.write (len) ;/ / file byte write how many times
method call is not the same . 1st floor
say is right
Whether copy_1 the buff, and BufferedInputStream buffers are built in order to improve efficiency
I then print the number is wrong.
specific execution order is :
BufferedInputStream the input data stream will fill in batches into the buffer . Every time after the data buffer is read , the input stream will once again fill the data buffer ; and so forth, until we read the position of the input data stream .
The FileInputStream by using copy_1 the buff effect is basically the same.
Thanks, everybody !

After running tomcat project deployment is false, can not start

project after deployment running as false, can not start , the error log :

Apr 02, 2014 2:06:47 pm org.apache.catalina.startup.ContextConfig parseWebXml
serious : Parse error in application web.xml file at jndi :/ localhost / fut / WEB-INF / web.xml
org.xml.sax.SAXParseException; systemId: jndi :/ localhost / fut / WEB-INF / web.xml; lineNumber: 9; columnNumber: 27; ; Error at (9, 27): For input string: ""
at org.apache.tomcat.util.digester.Digester.createSAXException (Digester.java: 2687)
at org.apache.tomcat.util.digester.Digester.createSAXException (Digester.java: 2719)
at org.apache.tomcat.util.digester.Digester.endElement (Digester.java: 1054)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement (AbstractSAXParser.java: 609)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement (AbstractXMLDocumentParser.java: 183)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement (XMLDTDValidator.java: 766)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement (XMLDocumentFragmentScannerImpl.java: 1342)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl $ FragmentContentDriver.next (XMLDocumentFragmentScannerImpl.java: 2770)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next (XMLDocumentScannerImpl.java: 606)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument (XMLDocumentFragmentScannerImpl.java: 510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse (XML11Configuration.java: 848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse (XML11Configuration.java: 777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse (XMLParser.java: 141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse (AbstractSAXParser.java: 1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl $ JAXPSAXParser.parse (SAXParserImpl.java: 649)
at org.apache.tomcat.util.digester.Digester.parse (Digester.java: 1537)
at org.apache.catalina.startup.ContextConfig.parseWebXml (ContextConfig.java: 1742)
at org.apache.catalina.startup.ContextConfig.webConfig (ContextConfig.java: 1174)
at org.apache.catalina.startup.ContextConfig.configureStart (ContextConfig.java: 828)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent (ContextConfig.java: 302)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent (LifecycleSupport.java: 119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent (LifecycleBase.java: 90)
at org.apache.catalina.core.StandardContext.startInternal (StandardContext.java: 5148)
at org.apache.catalina.util.LifecycleBase.start (LifecycleBase.java: 150)
at org.apache.catalina.core.ContainerBase.addChildInternal (ContainerBase.java: 866)
at org.apache.catalina.core.ContainerBase.addChild (ContainerBase.java: 842)
at org.apache.catalina.core.StandardHost.addChild (StandardHost.java: 615)
at org.apache.catalina.startup.HostConfig.deployDescriptor (HostConfig.java: 649)
at org.apache.catalina.startup.HostConfig $ DeployDescriptor.run (HostConfig.java: 1581)
at java.util.concurrent.Executors $ RunnableAdapter.call (Executors.java: 471)
at java.util.concurrent.FutureTask.run (FutureTask.java: 262)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java: 1145)
at java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java: 615)
at java.lang.Thread.run (Thread.java: 744)
Caused by: java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString (NumberFormatException.java: 65)
at java.lang.Integer.parseInt (Integer.java: 504)
at java.lang.Integer.valueOf (Integer.java: 582)
at org.apache.catalina.deploy.ServletDef.setLoadOnStartup (ServletDef.java: 179)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java: 57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java: 43)
at java.lang.reflect.Method.invoke (Method.java: 606)
at org.apache.tomcat.util.IntrospectionUtils.callMethodN (IntrospectionUtils.java: 904)
at org.apache.tomcat.util.digester.CallMethodRule.end (CallMethodRule.java: 532)
at org.apache.tomcat.util.digester.Digester.endElement (Digester.java: 1051)
... 31 more

Apr 02, 2014 2:06:47 pm org.apache.catalina.startup.ContextConfig parseWebXml
serious : Occurred at line 9 column 27
Apr 02, 2014 2:06:48 pm org.apache.catalina.startup.ContextConfig configureStart
serious : Marking this application unavailable due to previous error (s)
Apr 02, 2014 2:06:48 pm org.apache.catalina.startup.TldConfig lifecycleEvent
serious : Error processing TLD files for context with name [/ fut]
java.lang.IllegalArgumentException: MALFORMED
at java.util.zip.ZipCoder.toString (ZipCoder.java: 58)
at java.util.zip.ZipFile.getZipEntry (ZipFile.java: 531)
at java.util.zip.ZipFile.access $ 900 (ZipFile.java: 56)
at java.util.zip.ZipFile $ 1.nextElement (ZipFile.java: 513)
at java.util.zip.ZipFile $ 1.nextElement (ZipFile.java: 483)
at java.util.jar.JarFile $ 1.nextElement (JarFile.java: 243)
at java.util.jar.JarFile $ 1.nextElement (JarFile.java: 238)
at org.apache.tomcat.util.scan.FileUrlJar.nextEntry (FileUrlJar.java: 76)
at org.apache.catalina.startup.TldConfig.tldScanJar (TldConfig.java: 482)
at org.apache.catalina.startup.TldConfig.access $ 100 (TldConfig.java: 58)
at org.apache.catalina.startup.TldConfig $ TldJarScannerCallback.scan (TldConfig.java: 276)
at org.apache.tomcat.util.scan.StandardJarScanner.process (StandardJarScanner.java: 241)
at org.apache.tomcat.util.scan.StandardJarScanner.scan (StandardJarScanner.java: 166)
at org.apache.catalina.startup.TldConfig.execute (TldConfig.java: 250)
at org.apache.catalina.startup.TldConfig.lifecycleEvent (TldConfig.java: 540)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent (LifecycleSupport.java: 119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent (LifecycleBase.java: 90)
at org.apache.catalina.core.StandardContext.startInternal (StandardContext.java: 5148)
at org.apache.catalina.util.LifecycleBase.start (LifecycleBase.java: 150)
at org.apache.catalina.core.ContainerBase.addChildInternal (ContainerBase.java: 866)
at org.apache.catalina.core.ContainerBase.addChild (ContainerBase.java: 842)
at org.apache.catalina.core.StandardHost.addChild (StandardHost.java: 615)
at org.apache.catalina.startup.HostConfig.deployDescriptor (HostConfig.java: 649)
at org.apache.catalina.startup.HostConfig $ DeployDescriptor.run (HostConfig.java: 1581)
at java.util.concurrent.Executors $ RunnableAdapter.call (Executors.java: 471)
at java.util.concurrent.FutureTask.run (FutureTask.java: 262)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java: 1145)
at java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java: 615)
at java.lang.Thread.run (Thread.java: 744)

Apr 02, 2014 2:06:48 pm org.apache.catalina.core.StandardContext startInternal
serious : Error getConfigured
Apr 02, 2014 2:06:48 pm org.apache.catalina.core.StandardContext startInternal
serious : Context [/ fut] startup failed due to previous errors
Apr 02, 2014 2:06:48 pm org.apache.catalina.startup.HostConfig deployDirectory
Information : Deploying web application directory C: \ Program Files \ Apache Software Foundation \ Tomcat 7.0 \ webapps \ docs
Apr 02, 2014 2:06:48 pm org.apache.catalina.startup.HostConfig deployDirectory
Information : Deploying web application directory C: \ Program Files \ Apache Software Foundation \ Tomcat 7.0 \ webapps \ examples
Apr 02, 2014 2:06:49 pm org.apache.catalina.startup.HostConfig deployDirectory
Information : Deploying web application directory C: \ Program Files \ Apache Software Foundation \ Tomcat 7.0 \ webapps \ host-manager
Apr 02, 2014 2:06:49 pm org.apache.catalina.startup.HostConfig deployDirectory
Information : Deploying web application directory C: \ Program Files \ Apache Software Foundation \ Tomcat 7.0 \ webapps \ manager
Apr 02, 2014 2:06:49 pm org.apache.catalina.startup.HostConfig deployDirectory
Information : Deploying web application directory C: \ Program Files \ Apache Software Foundation \ Tomcat 7.0 \ webapps \ ROOT
Apr 02, 2014 2:06:49 pm org.apache.coyote.AbstractProtocol start
Information : Starting ProtocolHandler ["http-bio-8080"]
Apr 02, 2014 2:06:49 pm org.apache.coyote.AbstractProtocol start
Information : Starting ProtocolHandler ["ajp-bio-8009"]
Apr 02, 2014 2:06:49 pm org.apache.catalina.startup.Catalina start
Information : Server startup in 2273 ms

/ localhost / fut / WEB-INF / web.xml content

PUBLIC "-. / / Sun Microsystems, Inc / / DTD Web Application 2.3 / / EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">


initenv
sys.Conn.initenv



DownloadFilter
com.fut.utils.DownloadFilter


DownloadFilter
/ marcdata / preorder / *


doc
application / vnd.ms-word


xls
application / vnd.ms-excel


ppt
application / vnd.ms-powerpoint


index.html
index.htm
index.jsp


404
/ err / index.htm


505
/ err1/index.htm



ask how to deal with
------ Solution --------------------------------- -----------
lineNumber: 9; columnNumber: 27 web.xml parsing error.
------ For reference only -------------------------------------- -
the following web.xml while also being given ,

xmlns = "http://java.sun.com/xml/ns/j2ee"
xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi: schemaLocation = "http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd ">
------ For reference only ---------- -----------------------------
WebContent / WEB-INF / web.xml; lineNumber: 2; columnNumber: 9; document is invalid : no grammar.

Inline styles automatically generated JSP how to remove

project in the JSP is an ID style

# main {
position: relative;
height: auto;
}
browser to see there padding-top interface
browser debugging tools out of the code :


I ask how can we get rid of automatically generated that style , writing style directly in the JSP which is useless.

On not figure good grief , can only be so described limited ability to express hope someone can understand.
------ Solution ---------------------------------------- ----
style = "padding-top: 0;"?
------ Solution ---------------------------------------- ----
estimated to be somewhere else to set the div style , you add this to try
<div style="padding-top: 0px !important;"></div>

------ Solution ------------------------------------- -------

  
  
  
     
  
add style useless in JSP code  
Why ? Why not a priority
unless js set
------ Solution ------------------------------- -------------
it is impossible to write js remove him
------ Solution --------------- -----------------------------
1. What is the style automatically generated ? Never seen his generation .
2.jsp in writing style is useless, this is to say what
------ For reference only ------------------ ---------------------






add style useless in JSP code
------ For reference only -------------------------- -------------

    
    
    
         
    
add style useless in JSP code          
Why ? Why not a priority   
unless it is set js  
really JS settings = . = ! Last week, busy, no time to knot paste

Urgent help ! ! ! Questions about the Graphics class returns a null pointer

 This post last edited by u014246256 on 2014-05-26 12:18:28
//这些代码就是想在frame 窗口中画一条直线。

一.  返回空指针的错误代码。

public class Demo
{
    public static void main(String[] args)
    {
        Frame   f   = new Frame();
        f.setBounds(300,200,600,400);
       
        f.getGraphics().drawLine(1,1,100,100);   //这句话在编译时通过,但运行时却返回空指针异常
  //好像是getGraphics()方法没有获得Graphics对象。
        f.setVisible(true);
}


//但是这些代码却能正确执行。

二.   正确代码。

public class Demo
{
    public static void main(String[] args)
    {
        Frame   f   = new Frame();
        f.setBounds(300,200,600,400);
 
 //先创建一个监听器,并注册到f中,
//再通在监听器中通过getSource()得/到 f,然后再调用getGraphics()方法就行了。
//这不相当于绕了一个弯路吗?       
       f.addMouseListener(new MouseAdapter(){           
             public void mousePressed(MouseEvent   e)
             {
                     e.getSource().getGraphics().drawLine(1,1,100,100);
              }
         });
                                                                                         
        f.setVisible(true);
}


//怎样直接就能在f中画图呢???


there is another problem :

I customize a class called t let him inherit the Frame class , so I cover the paint () method, this method is not dead in the object the establishment of automatic call it? T go in this drawing class , simply do not consider the problems of the Graphics object . ( Because the paint () automatically, so there is no need for me to call paint (), of course, will not I create a Graphics object to pass actual parameters to the paint.) See next code :
class t extends Frame
{
    public void paint(Graphics g)
    {
        g.drawLine(1,1,70,80); 
    }
}
public class Demo
{
    public static void main(String[] args)
    {
        t   f   =   new t ();
        f.setBounds(300,200,600,400);
       f.setVisible(true);       
     }
}


However, this is not a passive way of drawing it? Because it is the paint () method is called automatically when you create an object .

To sum up : the Graphics class is about the problems of the object.
------ Solution ---------------------------------------- ----
using a method is necessary to understand the characteristics of a method , you encounter a mistake not to mention a closer look at that method
Here is the Javadoc for this method of presentation
Creates a graphics context for this component. This method will return null if this component is currently not displayable.
written very clearly, when the component is not currently displayed , it will return null So you have to setVisible

there is a problem , if you just drawLine painting once , then you can not see the effect , because the form is constantly redrawn , which is constantly emptied the contents , if you want to see results , you to continue drawLine, like this , but this approach is not good , the correct approach should be rewritten paint .
		Frame f = new Frame();
f.setSize(400, 300);
f.setVisible(true);

Graphics g = f.getGraphics();

while (true) {
g.drawLine(1, 1, 100, 100);
}

------ For reference only ----------------------------------- ----
Aoao , I tried, and you said the same.
But why rewrite the paint () method can solve the problem of the form redraw it . Is not to rewrite the paint method to redraw it?
redraw is how the matter .
I am a novice , please bear with me.
------ For reference I had read only ---------------------------------------
API documentation but did not understand , thank you master pointing .

public Graphics getGraphics ()
create a graphics context for the component . If the component is currently not displayed , this method returns null.

Returns:
components graphics context , if it does not , it returns null
start from the following versions :
JDK1.0
See also :
paint (java.awt.Graphics)

------ For reference only ---------------------------------- ----- mechanism
Swing is a Component of the appearance of the paint method is drawn , then he will be repeated ( for example, 60 times a second ) call the paint to ensure timely updated UI , which also provides animation support , animation has always been more than an illusion screen showing a short form
redraw refers repaint, whether you re not overridden paint method will redraw .
------ For reference only -------------------------------------- -
figuratively speaking, is the Graphics is a drawing board , paint is a painter , and repaint the leader , leader told the artist , every 1 /60 second , first wipe the slate original and re- painting again, this is heavy painted
rewrite paint method is equivalent to , you tell a painter, not to draw you want to draw something original , I'll tell you what to draw , how to paint .
And you did getGraphics first method is equivalent to , you first take it over the drawing board , above the artist 's paintings , and then modify your own , so make sure you modify the user can see , you can only painter same speed or faster than him , or you painted , 1 / 60 seconds after being erased painter , but still a bad practice
------ For reference only - --------------------------------------
you handsome ! I understand
, thank you !

How to determine the external JS finished loading

page introduces a third party JS,
I want to know how to judge the JS JS code has been finished loading .
such as:



This xxx.js all finished loading .
------ Solution ---------------------------------------- ----
http://blog.csdn.net/huli870715/article/ details/6373170

------ Solution - -------------------------------------------
look upstairs
------ Solution ------------------------------------- -------
< br> ------ Solution ----------------------------------------- ---

the contents of this link should be able to solve the problem, right
------ Solution ------------------ --------------------------
browser is blocking the order to load the document , right ?
That is when the script is loaded before him , he has not yet loaded, when he loaded the script after he certainly loads better.
Could now have the default browser and even multi-threaded asynchronous page load it?
------ Solution ---------------------------------------- ----
script tag should be synchronized blocking

Weekend, relax , incidentally scattered points


you for java programmers , look at this video to !
http://my.tv.sohu.com/us/764929/52336255.shtml
------ Solution ------------------------------------ --------
there is a stupid system used in the original EJB
------ Solution ------------------------------ --------------
really strong , ha ha ha
------ Solution ------------------ --------------------------
top one haha
------ Solution - -------------------------------------------
Nani ?
I had a go ;
I'm in overtime ..............................

------ Solution - -------------------------------------------
Java4Ever
http://v.youku.com/v_show/id_XMTkxNDk2ODY0.html
- ----- Solution --------------------------------------------

----- - Solution --------------------------------------------
overtime how to say , every three plus one . Added 10 points . It is the envy ah. Only look at this video to entertain yourself slightly
------ Solution ------------------------------ --------------
you're a programmer , you have to be a programmer in this life
------ Solution - -------------------------------------------
either watched this post, I do not know it is the weekend
------ Solution - -------------------------------------------
access points, video a bit exaggerated . .
------ For reference only -------------------------------------- -

---- - For reference only ---------------------------------------
2 of 27 second , beautiful appearance dialogue:

You can use Java to do very coordinated and balanced , but mixed and Microsoft can not.

there a better interpreter?
------ For reference only -------------------------------------- -

---- - For reference only ---------------------------------------

String into Date type of problem

previously Date date = new Date (Str s) s can be converted to Date type.
now also be specified with Simpledateformat style : If Simpledateformat ss = new Simpledateformat ("yyyy-MM-dd HH: mm: ss") Date type to turn through the parse.
But there is a problem, I wanted to write a utility class , I do not know what kind of style the incoming string , how to convert Date types? Seek expert advice ah
------ Solution ------------------------------------ --------
not. . .
------ Solution ---------------------------------------- ----
fully automatic is not possible, the regular expression can be specified in several formats that can be entered and then determine the conversion
------ Solution ------------ --------------------------------
exhaustive of all types , according to the passed parameter types to match to type conversion .
------ Solution ---------------------------------------- ----
pass two parameters can write a utility class , such as:

public static Date toDateSafely(String simpleType,String stringDate){
try{
SimpleDateFormat dateFormat = new SimpleDateFormat(simpleType); 
    return dateFormat.parse(stringDate); 
}catch(Exception e){
return null;
}
}


------ Solution ------------------------------------- -------
commons there DateUtils can
------ Solution ------------------------ --------------------
make a sauce just 22
------ Solution ------------ --------------------------------

/**
 * String 转 Date
 * auther: shijing
 * 2014-5-9下午03:16:14
 * @param str
 * @param format
 * @return
 */
public static Date string2Date(String str, String format) {
DateFormat dateFormat = new SimpleDateFormat(format);
Date date = null;
try {
date = dateFormat.parse(str);
}
catch (ParseException e) {
e.printStackTrace();
}
return date;
}


This is what I often write DateUtils One way
------ Solution ------------------------ --------------------
uncertainty inflicted on one parameter . . .
------ Solution ---------------------------------------- ----
as exhaustive . . .
constantly try catch to try and succeed on the return, failure to continue to parse.
------ Solution ---------------------------------------- ----

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Test3 {
public static Date parseDate(String time) {
String pattern = "";
if (time.contains("-")) {
pattern += "yyyy-MM-dd";
} else if (time.contains("年")) {
pattern += "yyyy年MM月dd日";
}
if (time.contains("上午") || time.contains("下午")) {
if (!pattern.equals("")) {
pattern += " ";
}
pattern += "a";
}
if (time.contains(":")) {
if (!pattern.equals("")) {
pattern += " ";
}
pattern += "HH:mm:ss";
}
try {
return new SimpleDateFormat(pattern).parse(time);
} catch (ParseException e) {
e.printStackTrace();
return null;
}
}

public static void main(String[] args) {
System.out.println(parseDate("2014-05-26 下午 16:22:13"));
System.out.println(parseDate("2014-05-26"));
System.out.println(parseDate("16:22:13"));
System.out.println(parseDate("2014-05-26 16:22:13"));
System.out.println(parseDate("2014年05月26日 16:22:13"));
}
}

basic common no problem
------ Solution ------------------------------- -------------
lazy to have boundaries. . Unless you know your format is fixed and that several, and then one by one to try , otherwise it is impossible to have a universal method 01/02/2014
For example , the format does not tell you , how do you know this is February 1 , or January 2 ? Both formats are very common format , so I can not judge
------ For reference only ------------------------ ---------------
For example, I now have two strings
		String input1="2014-05-23 09:23:33";
String input2="2014-05-23 上午09:23:33";
how to put them into a Date type ,
with SimpleDateFormat dateFormat = new SimpleDateFormat ("yyyy-MM-dd HH: mm: ss"); input1 can only turn one way how to write as much as possible . match many styles , or what can be achieved?
------ For reference only -------------------------------------- -
able to write a simple example ?
------ For reference only ---------------------------------------
en, yes, but every time you call this method must know what form stringDate time string to the corresponding rid simpleType. lazy I think the point is , I do not have to care about what it was like passed in stringDate , give me time to turn on the type of good
------ For reference only ------------------------------------- -
Thank you join , knot posted . No wonder, then ah unequal share

CXF WebService configuration-related , in detail

Now there is a project with CXF WebService service provided

As the beginner, it took more than one day to achieve the function , the following is my server code
interfaces:

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;

@WebService
public interface TbSysUserinfoFor4AWebService {
@WebMethod
public String UpdateAppAcctSoap(@WebParam(name = "requestInfo") String requestInfo);
}

achieve :

@Service("userinfoManageFor4A")
@WebService(endpointInterface="service.tbSysUserinfoFor4AService.TbSysUserinfoFor4AWebService")
public class TbSysUserinfoFor4AWebServiceImpl implements
TbSysUserinfoFor4AWebService {
@SuppressWarnings("finally")
@Override
public String UpdateAppAcctSoap(String requestInfo) {
                 // 具体实现略
                return xml;
        }
}

xml configuration:

<jaxws:server address="/userinfoManageFor4A" >
<jaxws:serviceBean>
<ref bean="userinfoManageFor4A"/>
</jaxws:serviceBean>
</jaxws:server>


I tested with the axis, the code below.

public class TestWebService {
@Test
public void testUserInfoWebService(){
                        String xml = "<?xml version='1.0' encoding='UTF-8'?>略</USERMODIFYREQ>";
String url = "http://localhost:8080/cloud/WebService/userinfoManageFor4A?wsdl";
String method = "UpdateAppAcctSoap";
String parameterName = "requestInfo";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(url);
QName qName = new QName("http://tbSysUserinfoFor4AService.service/", method);
// QName qName = new QName(method, method);
call.setOperationName(qName);
call.setUseSOAPAction(true);
call.addParameter(parameterName, XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType(XMLType.XSD_STRING);
String msg = call.invoke(new Object[]{xml}).toString();
System.out.println(msg);
               }
}
ways to achieve access to the results and return to normal ;
service after starting up, with QName qName = new QName ("http://tbSysUserinfoFor4AService.service/", method)


with other systems in the FBI doing testing , I found the other side of the access method with my little test access the same way

FBI found the time to test each other's access method is QName qName = new QName (method, method); That is the other side of namespaceuri Qname parameters and parameters are the same behind a content in this way to visit my services can not always access

party system also provides WebService service , and the other I wrote a similar client code to access each other's services , with the QName qName = new QName (method, method); way to visit , but also a normal visit and return results

It seems that this approach is feasible , the difference should be the end of my service configuration might not reach each other's requirements

that CXF server how to configure it to allow two parameters Qname same content?

Please help me see how to achieve here , thank you !


------ Solution ------------------------------------ --------
the first parameter is the namespace , this value can be found in the screenshot wsdl oh .
when you publish the namespace and method names can be configured the same .
------ For reference only -------------------------------------- -


Thank you , find where the problem before it is a problem that namespace , I also give separate interfaces and implementation classes plus over targetNameSpace, have no effect

has not been added to both targetNameSpace parameters must be added here is we can .

Thank you for your reply

tomcat reported Connection reset by peer: socket write error

 This post last edited by the yhc13429826359 on 2013-06-04 14:56:49
recently developed web service client calls android , android connect to the router , the router and the computer , this error is not every day , but occasionally there will be one
but has been reported after the first appearance of this error , close tomcat, restart the computer are not used, this error next time tomcat start up is still being given , unless broken network restart, restart the router , this error will be solved.

The key is that the error is not common, can not debug , the number of occurrences of rare, but once it has been given .
log soaring .
how to catch this exception , and how is this anomaly ,
First, say something, do not look at a few possibilities:
1. server responds , the client firewall is blocking
2 concurrent connections the server exceeded its carrying capacity , some of which will be connected to the server is Down . ;


------ Solution ------------------------------------ --------
this error is due to the browser closes the connection with the tomcat caused .
------ Solution ---------------------------------------- ----
I actually want to say a client ( in most cases is a browser)

After you make sure the connection is closed , there is no interaction it?
not to paste a code look .
------ For reference only -------------------------------------- -

is android connect my service , no browser , just make use of the service , so there is no question browser , android is after I finished reading the response data before closing the connection < . br> ------ For reference only ---------------------------------------

no, this code will not be posted , thank you , and the company finally posted a code to open a csdn immediately to shut , csdn did not get on .
------ For reference only ---------------------------------------
landlord I also appeared this problem , android client access backstage on the error, but always good to download , pc terminal is not being given good . Depressed ah