2013年11月21日星期四

About Resolution and filters have two questions

If that one , how to make a DIV JSP pages automatically filled based on different resolutions whole page ?
2, IE how do I find the Internet a gradient background with a filter for a long time did not seem to effect
------ Solution --------------------------------------------
1. screen resolution , div on the aspect , the screen resolution is set
height returns the display screen height.
width returns the width of the display screen .

availHeight return to screen height ( except Windows task bar outside ) .
availWidth return to display the screen width ( except Windows task bar outside ) .
of course, minus the browser's address bar, toolbar , this is not very good, With this two

document.documentElement.scrollWidth document.documentElement.scrollHeight,
Or, just remove the body of padding, and margin, set up 100%

2. using jquery like gradient

------ Solution ------------------------------------ --------
width: 100%; height: 100%;

Share a picture :


gradient : http://www.zhangxinxu.com/wordpress/2010/04/css% E5% AE% 9E% E7% 8E% B0% E5% 85% BC% E5% AE% B9% E6% 80% A7% E7% 9A% 84% E6% B8% 90% E5% 8F% 98% E8% 83% 8C% E6% 99% AFgradient% E6% 95% 88% E6% 9E% 9C /
- ----- For reference only ---------------------------------------

Thank you help first problem occurs if the IE toolbar that mess I think is just the scroll bar does not appear automatically fill can achieve thing ?
I just put it first opened toolbar sliding down the entire page appeared on the scroll bar

About the system time and time have problems

database System time and database time What is the difference ?
That is when the client was in the landing this time what is time ?

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


It depends on your web log system to take the time, or the client server time ?
time you visit a client machine's system time ,
time a web server system constructed db server's system time . .
------ For reference only -------------------------------------- -
database time and your system time is likely to be inconsistent.
all the time if you want a standard , it is recommended to take a unified database Time : sysdate.
------ For reference only -------------------------------------- -
is your current system time
------ For reference only ----------------------------- ----------
server, the client
------ For reference only --------------------- ------------------

Oh, you say the most detailed to give you points
ask a wish to obtain landing should be a time when the system time is chanting
------ For reference only -------------- -------------------------


are the system time , the key is which machine 's system time ,
is the client machine's system time, or server machine 's system time .
It depends on the system requirements.
------ For reference only -------------------------------------- -


this database , how time and local time synchronization ah ?

Java Servlet can take the initiative to initiate a POST request another address it ?

In my Servlet on the server , you need to use another server on the data displayed on a page ,
So, I think by the Servlet to this page to initiate a POST request , then the returned data with Servlet own data together.

I have this need to achieve it ?
how to achieve ?
Thank you !
------ Solution ---------------------------------------- ----
can use HttpURLConnection this class,
detailed usage can Google it, pay attention to consider the timeout situation
------ Solution ------------------------- -------------------
urlStr / / your address
URL url = new URL (urlStr.toString ());
/ / System.out.println (urlStr.toString ());
httpConnection = (HttpURLConnection) url.openConnection ();
httpConnection.getContentEncoding ();
/ / get the return value
java.io.InputStream in = httpConnection.getInputStream ();
BufferedReader breader = new BufferedReader (
new InputStreamReader (in, "gbk"));
String lines = "";
while ((lines = breader.readLine ())! = null) {
str = lines;
System.out.println (str);
}
------ For reference only --------------------------------- ------




Thank you for your answer .
this way , then , POST parameters how to pass ? Thank you !

How to set caching data in JS

Now it wants some practical frequent basis data cached on the client , please heroes exhibitions ah
------ Solution ----------------- ---------------------------
added: json format used on the line .
example

<script type="text/javascript" language="javascript">
 var languages = {
    cn:{
    lang:'ch',
    name:"中文"
 },
 en:{
    lang:"英文",
    name:"en"
 }
 };
 document.write(languages.cn.name);
</script>

------ Solution ------------------------------------- -------
js variable exists on the line

more data storage array

want to have saved json array format

actually finally a variable of an object and the background cache a java meaning
------ Solution -------------- ------------------------------
used jquery easyui do ?
more practical you this question , never used can look at

background Controllr in :

Front js Lane :



------ Solution ------------------------------------ --------
previous direct deposit a cookie so good
Now it can exist localstorage or localsession inside
------ For reference only --------------------- ------------------
master where ah , Online . . . . . .
------ For reference only -------------------------------------- -
own package a js object on the line ah !
------ For reference only -------------------------------------- -
exist client do ?
can put hidden controls on the page , in the control store variable values.
------ For reference only -------------------------------------- -
json array ,
------ For reference only ------------------------------ ---------
new array
------ For reference only ----------------------- ----------------
code uploaded backwards, brokered see, to convey a general meaning ! ! ! Oh
------ For reference only ------------------------------------- -
data sets cached in JS cookies?
------ For reference only ------------------------- --------------
to serialize the data to json format
then stored in hidden controls to the page
call to take the value of hidden controls
this problem it
------ For reference only ---------------------------- -----------

. . . . . .

What is the method to achieve the air ?

The following procedure is wrong , one is prompted to "Test.java: 63: error: parse have reached the end of file
} ", but I checked , there is no lack of" } "Ah , another run to remind all the methods of abstract classes not covered , but I think not cover , I checked Baidu , said you can empty achieve , ask me how empty this program implements the abstract method in a class ?

import java.util.*;

public class Test
{
public static void main(String[] args)
{
Employee[] employee = new Employee[2];
employee[0] = new A("ert", "computer");
employee[1] = new B("rty", 5000);

for(Employee i: employee)
{
System.out.println(i.getName()+","+i.getMajor()+","+i.getSalary());
}

}
}

abstract class Employee
{
private String name;

public Employee(String n)
{
name = n;
}

  public String getName()
  {
   return name;
  }

 public abstract  String getMajor();
 public abstract double getSalary();
}

class A extends Employee
{
private String major; 
public A(String n, String m)
{
super(n);
major = m;
}
public String getMajor()
{
return major;    
}

class B extends Employee
{
private double salary;
public B(String n, double x)
{
super(n);
salary = x;
}

public double getSalary()
{
return salary;
}
}

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

class A extends Employee
{
        private String major; 
        public A(String n, String m)
        {
            super(n);
            major = m;
        }
        public String getMajor()
        {
            return major;          
        }//这里少个括号
}

------ Solution --------------------------- -----------------
class A getMajor way less of a "}" ;
classes A and B have one less implemented method
------ Solution ------------------------- -------------------
is no specific method body .
------ Solution ---------------------------------------- ----
empty implementation is nothing to write within the {}
------ Solution ----------------------- ---------------------


landlord to see red font , you are the method's return value is double , the method must return a value,
can write public void getSalary {

} Try

Do not forget to settle landlord posted

------ For reference only ---------------------------------------
Thank you, indeed one less } , in addition, A and B of the method less , how to make it? , The procedure variables in each class is fixed.
------ For reference only -------------------------------------- -
If nothing written inside { } will appear this error message " missing return statement ." In the A category is what I added
public double getSalary()
{

}



------ For reference only ---------------------------------- -----
public void getSalary () {

}

Sorry , fewer parentheses
------ For reference only ---------------------------------------
8 floor would not work . There will be " not covered by the abstract class method " error .
------ For reference only -------------------------------------- -
I generally Results posted soon , is waiting for the answer, this post I will end up with it. After more study, the more other , perhaps solved.
------ For reference only -------------------------------------- -
http://blog.csdn.net/shadowsick/article/details/8903278
I suggest you come to my blog to download a project examples , I believe you learn more help , which has a general usage
------ For reference only ---------------------------------------
you those methods have return values Therefore, the implementation is empty
public double getSalary () {
return null;
}
------ For reference only --------------------------------- ------
shadowsick, go to your blog to read, I was just entering JAVA, looking very basic knowledge , understand your project a little more difficult , my collection , and hope that their knowledge can be achieved after easy to understand the extent of your project . Thank you.
------ For reference only -------------------------------------- -
landlord, you do not quote you, we can not see your reply

js how to engage in this

javascript how to connect oracle database and CRUD, with detailed code on the code
recently to be a small thing , there are some small data dictionary field I used this way
------ Solution ------------------ --------------------------
if you want to use to connect to the js on the page , it should not, but if a local developer should be able to use nodejs
------ Solution ---------------------------------------- ----
via ajax to the background ? Then how to get all over you
------ Solution --------------------------------- -----------
js? ? Directly connected to the database ? Want more of it . node.js possible, did not go in-depth study .
------ For reference only -------------------------------------- -
Why do it . Reception can not see js / ? Is encrypted can be cracked.

Help : spring + JDBC DataSource Why not inject



//spring 配置
  <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="com.mysql.jdbc.Driver" />
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/cdb" />
<property name="user" value="root"/>
<property name="password" value="123456"/>
</bean>

<bean id="cpaction" class="com.fw.ls.cp.action.CpAction">
<property name="dataSource" ref="dataSource"></property>
</bean>

//CpAction  

        private DataSource dataSource;

public String add(){
JdbcTemplate jt = new JdbcTemplate(dataSource);
String sql = "insert into cp(id,xuhao,dianhua)values(id,?,?)"; 
jt.update(sql,"casc","1212");
return SUCCESS;
}

        public void setDataSource(DataSource dataSource) {
this.dataSource = dataSource;
}

//错误代码
java.lang.IllegalArgumentException: Property 'dataSource' is required
setDataSource(DataSource dataSource)并没有进入这个方法就报错了

------ Solution ------------------------------------- -------
there Struts bar
facie 6F answer this post
I hope to help you

Help , java how to call ocx control in the event ?

The following are ocx controls for use:

1. Open Initialization:
txUDP1.UDPConnect ()
Returns:
0. Description Success
1. Description Failure: Reason may have been another device port or disable
' error returns an error message

2. End Close
txUDP1.UDPclose

3. obtain data events
txUDP1_UDPdata
---------------------------------------------- ---------------------
'5 states: ----- mark symbol ( state ) , Caller ID , user name / line number, channel , E ( terminator )
' the first one kind of call number : M, 075526664777,26664777,01, E
' first two kinds of outgoing calls : T, 075526664777,26664777,01, E
' s three kinds of call -hook : A, 26664777,01, E ( effective when used in the incoming channel status )
' fourth -hook : B, 26664777,01, E
' first five kinds of missed calls : X, 26664777,01, E

Use jacob call, which method can call succeeds, but the event did not activate .

The following is my code :
public static void main (String [] args) {
JFrame f = new JFrame ();
JTextArea ta = new JTextArea ();
f.add (ta);
f.setSize (400, 500);
f.setVisible (true);

ActiveXComponent com = new ActiveXComponent ("txUDPOCX.txUDP");
Dispatch disp = com.getObject ();
/ / Initialize - 0 for success 1 for failure
System.out.println (Dispatch.call (disp, "UDPConnect"));
Listener listener = new Listener ();
listener.setTa (ta);
/ / listen for events
DispatchEvents de = new DispatchEvents (disp, listener, "txUDPOCX.txUDP");
/ / Dispatch.call (disp, "UDPclose");
}

event code :
public class Listener {
JTextArea ta;
public JTextArea getTa () {
return ta;
}
public void setTa (JTextArea ta) {
this.ta = ta;
}
public void txUDP1_UDPdata (Variant [] txUDP1_UDPdata) {
ta.append ("aaaa");
}
}

wrong it is not there ? Great God seeking guidance ......

------ Solution ------------------------------------ --------
import com.jacob.com.ComThread;
import com.jacob.com.Dispatch;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.DispatchEvents;
import com.jacob.com.Variant;
import java.io.IOException;


public class ocx {
public ocx () {
ComThread.InitMTA (true);
ActiveXComponent iTunesCom = new ActiveXComponent ("clsid: 287B48B3-80CA-4D0A-AE8E-F97A824FF279");
Dispatch testOcx = (Dispatch) iTunesCom.getObject ();
Dispatch.call (testOcx, "BaseConnect", new Variant ("COM3"), new Variant ("1,3-5"));
Dispatch.call (testOcx, "VoteNew");
Dispatch.call (testOcx, "VoteMode", new Variant ("5"), new Variant ("1,4,1"));
Dispatch.call (testOcx, "VoteStart");
DispatchEvents events = new DispatchEvents (testOcx, new KeyVoteA ());
try {
System.in.read ();
} catch (IOException e) {}
ComThread.Release ();
System.exit (0);
}

public class KeyVoteA {
/ / ocx event returned to the java class parameters to obtain
public void KeyVote (Variant [] args) {
System.out.println ("args [0] [" + args [0]. getInt ( ) ) ;
System.out.println ("args [1] [" + args [1]. getInt ( ) ) ;
System.out.println ("args [2] [" + args [2]. getString ( ) ) ;
}
}

public static void main (String args []) throws Exception {
ocx test = new ocx ();
}
}
------ Solution ----------------------------------- ---------
dll modulation method may be similar , the compiler generates stubs , agent. You can also use the OBJECT classid = "clsid: CAFEEFAC-0015-0000-0007-ABCDEFFEDCBA> This way calling
------ For reference only ------------- --------------------------
reference to the comments in the code section
------ For reference only ---- -----------------------------------
DispatchEvents events = new DispatchEvents (testOcx, new KeyVoteA ());


/ / ocx event returned to the java class parameters to obtain
public void KeyVote (Variant [] args) {
System.out.println ("args [0] [" + args [0]. getInt ());
System.out.println ("args [1] [" + args [1]. getInt ());
System.out.println ("args [2] [" + args [2]. getString ());
}


red font can understand
------ For reference only ----------------------------- ----------
Thank you god !
------ For reference only -------------------------------------- -
this way simply did not respond
------ For reference only -------------------------- -------------
jacob nine consecutive event listener to listen less , and after a period of time to wait before they can return to continue to return , is swollen thing ah
- ---- For reference only ---------------------------------------
< br /> upstairs how big God is listening ? Can be attached demo code does not ?
------ For reference only -------------------------------------- -
brethren, I have such a problem but also look advice twelve , QQ: 97604448
------ For reference only ------------- --------------------------
brethren, I have such a problem but also look advice twelve , QQ: 97604448  
brother, I would not , did not do it , then gave up, which may require JAVA development and OCX development engineers jointly developed between the FBI tests , otherwise unsupported mismatch can not do this forever .

bootstrap how to achieve compatibility ie8 browser , seeking answers to the great God ! !

 This post last edited by the q496749021 on 2013-10-31 09:53:05
I use the bootstrap layout page , but is not compatible with ie8, an open layout is a mess , other than that things are not ie8 , firefox browser with google and some things are not . Find great God answer ah ! ! ! !
------ Solution ------- -------------------------------------
bootstrap are using CSS3, so the following browsers ie9 not very smooth. The following IE9 compatibility is not very good .
IE itself is a freak, and the outside world to engage in a number of inconsistent standards . Do consider that web developers consider this compatibility , egg pain !

Basically css3 's not normal use :

- not display CSS 3 rounded corners - > all become box
- not display CSS 3 gradient - > quasi-physical buttons all become flat
- not display CSS 3 shadows - > box is the box , no shadow

found the next several solutions :
1. Bootstrap UI overall in IE8 narrowed down , and thus placed on the sleeve assembly

problem in IE8 does not support @ media, and Bootstrap a big advantage Responsive UI is completely based on the @ media . Solve this problem, use Respond.js https://github.com/scottjehl/Respond

2. Bootstrap UI components under the aesthetic problem in IE8

using bootstrap-ie78.css
------ For reference only --------------------------- ------------

or not. . . Are added . . . Layout is a mess . .
------ For reference only -------------------------------------- -
Jiqiu ah ! There is no god used ? ? Encountered such a thing ?
------ For reference only -------------------------------------- -


I have always felt is considering compatibility issues are all browser vendors want their browsers a dominant market share continued to fight if you do not consider compatible Finally got left one pair get our programmer is not necessarily a good thing at least we can focus both on the business
IE is not inconsistent standards but there is no addition to the standard features than MS also have a special , after all, people involved in the W3C specification If all browsers are the same only the syntax specified program using the W3C certainly no problem but not required to use some of that W3C is necessarily each with various practices and certainly not the same ; foreign intellectual property rights is very strict on the
------ For reference only -------------------------- -------------
forget. . . I use this version is 2.0 + is . . . After using 3.0 + is a not the same. . But IE8 is compatible . . . Other browsers is not much problem. .

eclipse.com download IDE is without jdk / jre 's right ?

To separate installation jdk / jre?
------ Solution --------------------------------- -----------
without the need to install their own separate

spring / hibenate can not rely J2ee directly above the ordinary j2se jdk installed and running ?

If that, thank you. .....
------ Solution ----------------------------------- ---------
Yes, you can import the relevant jar package

IntelliJ IDEA project will not start

D: \ ProgramFiles \ java \ apache-tomcat-6.0.37 \ bin \ catalina.bat run
[2013-11-20 04:12:02,766] Artifact accel-light-web: war exploded: Server is not connected. Deploy is not available .
Using CATALINA_BASE: "C: \ Users \ qiu \. IntelliJIdea12 \ system \ tomcat \ Unnamed_accel-light-web_2"
Using CATALINA_HOME: "D: \ ProgramFiles \ java \ apache-tomcat-6.0.37"
Using CATALINA_TMPDIR: "D: \ ProgramFiles \ java \ apache-tomcat-6.0.37 \ temp"
Using JRE_HOME: "D: \ ProgramFiles \ java \ jdk1.6.0_10"
Using CLASSPATH: "D: \ ProgramFiles \ java \ apache-tomcat-6.0.37 \ bin \ bootstrap.jar"
Connected to the target VM, address: '127 .0.0.1:49654 ', transport:' socket '
2013-11-20 16:12:03 org.apache.catalina.core.AprLifecycleListener init
Info : Loaded APR based Apache Tomcat Native library 1.1.27.
2013-11-20 16:12:03 org.apache.catalina.core.AprLifecycleListener init
Information : APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
2013-11-20 16:12:04 org.apache.coyote.http11.Http11AprProtocol init
Information : Initializing Coyote HTTP/1.1 on http-8080
2013-11-20 16:12:04 org.apache.coyote.ajp.AjpAprProtocol init
Information : Initializing Coyote AJP/1.3 on ajp-8009
2013-11-20 16:12:04 org.apache.catalina.startup.Catalina load
Information : Initialization processed in 1117 ms
2013-11-20 16:12:04 org.apache.catalina.core.StandardService start
Information : Starting service Catalina
2013-11-20 16:12:04 org.apache.catalina.core.StandardEngine start
Information : Starting Servlet Engine: Apache Tomcat/6.0.29
2013-11-20 16:12:04 org.apache.coyote.http11.Http11AprProtocol start
Information : Starting Coyote HTTP/1.1 on http-8080
2013-11-20 16:12:04 org.apache.coyote.ajp.AjpAprProtocol start
Information : Starting Coyote AJP/1.3 on ajp-8009
2013-11-20 16:12:04 org.apache.catalina.startup.Catalina start
Information : Server startup in 76 ms
Connected to server
[2013-11-20 04:12:04,868] Artifact accel-light-web: war exploded: Artifact is being deployed, please wait ...
then not move the browser is not up cmd-java have no problem alone would have no problem starting tomcat
------ Solution ------- -------------------------------------
started well, did not see what the problem is .
------ For reference only -------------------------------------- -
turnover why did not reply
------ For reference only ---------------------- -----------------
maven jar package where I went wrong version toss

spring transaction

The project is now in such a situation , , has been configured this transaction management , then that is A calls B, B calls C, I think A is a transaction , B to use try catch, do not use a transaction , C also use transactions , but does not , and A is a transaction. In this case how to solve ah. Find Great God help
------ Solution ------------------------------------- -------
you is how ? c the transaction, commit not affect A?, called a anomaly , a transaction rollback , c have the transaction commits .
call , c is an exception , the transaction is rolled back , b handle an exception , a transaction can still submit ?
Is that right ?
then your transaction propagation , it is necessary to make a change ,
a of propagation = "REQUIRES_NEW" Using the new transaction
------ Solution ------------------------- -------------------
in the B method definition , add annotation @ Transactional (propagation = Propagation.REQUIRES_NEW), creates a new transaction ; while in the configuration file annotation -based configuration method using transaction statement
- ---- For reference only ---------------------------------------
< br /> modify , the fact is that A calls C and B, c does not use a transaction , B using transactions , but do not want A and B in a single transaction . B is abnormal , just rollback B, A does not roll
------ For reference only ------------------------ ---------------
modification , the fact is that A calls C and B, c does not use a transaction , B using transactions , but do not want A and B in a single transaction . Exception is B , just rollback B, A does not roll
------ For reference only ---------------------- -----------------
then add the next , A, B in a class , C , and AB is not a class
------ For reference only ---------------------------------------
landlord profound ah. . .
------ For reference only -------------------------------------- -

quickly answer questions ah
------ For reference only -------------------------- -------------
hierarchical execution , and then configure each method's transaction , probably so the ,
------ For reference only ------ ---------------------------------

Well, if the above plus annotations in the B Method way can it , I have to call the next, seemingly not, or give me all rolled back
------ For reference only ----------------- ----------------------

9 F, positive solution, the test no problem. thanks

jsp page how hidden inside the same values ??and passed as a parameter ? ? ?

jsp code is as follows :



Requirements Description: how to tel_hidden in inside pass the value in the past ? That is, the "getByID.do? Telnumber =" + tel_hidden inside tel_hidden replaced 's value?
------ Solution ---------------------------------------- ----
/ / refactored code to achieve your needs



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

<head>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        var a = $("#a").attr("herf") + $("#tel_hidden").val();
        alert(a);
    })
</script>
</head>
    
<body>
     <input type="hidden" id="tel_hidden" value="sss" name="tel_hidden"/> 
        <ul>
        <li><a id="a" herf="getByID.do?telnumber="   target="dialog"  cc="true" rel="add"  >welcome</a></li>
        </ul>
</body>

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

function linkTo(){
alert(document.getElementById("tel_hidden").value);
window.location="getByID.do?telnumber="+document.getElementById("tel_hidden").value;
}
<a href="javascript:linkTo();">vvvv</a>

------ Solution --------- -----------------------------------
1, url parameter pass in the past ... do? telnumne = ..
2, form form
3, are used struts pins , struts1 struts2 form words with objects or write directly to the inside of the action do not forget to write private String tel_hidden get set method
------ For reference only ---------------------------------------

Thank you, but I want to know is how to place a value as an argument to herf = "getByID.do? telnumber ="? ? ? ?
------ For reference only -------------------------------------- -

Thank you, but I want to know is how to place a value as an argument to herf = "getByID.do? telnumber ="? ? ? ?  

replaced like following

var a = $("#a").attr("herf") + $("#tel_hidden").val();
$("#a").attr("herf", a);
alert($("#a").attr("herf"));

------ For reference only ----------------------------------- ----
Thank u011559804, the problem has been solved. Mainly pick up individual human stinks , do not want to change too much, so directly in the url inside pass in the past .

SSH under getHibernateTemplate (). Find (queryString) Error


as the database connection is no problem
novice dao is to build SSH automatically generated when
------ Solution ------------------------- -------------------
getHibernateTemplate hibenate did not succeed !

getHibernateTemplate is null
------ For reference only ------------------------------ ---------
missing SLF4J package , right ?
------ For reference only -------------------------------------- -
this is no difference between right
------ For reference only ----------------------------- ----------
heroes solving
------ For reference only ---------------------------------------
you look is not hiberante this is null
	System.out.println(getHibernateTemplate+"---->getHibernateTemplate");

------ For reference only ----------------------------------- ----
table name is Aa?
------ For reference only -------------------------- -------------
Yes
I know where the mistake is not hibernatetemplate the hibernate4
Thank you ~ ~

null! = xxx and xxx! = null What is the difference ?

null! = xxx and xxx! = null What is the difference ?
------ Solution ---------------------------------------- ----
this specification are many allusions , such as one of them, because programmers easy to == mistakenly written as =
If you put in front of the constant 5 = i, will compile errors , so you can find this typo bug


------ For reference only ---------------------------------- -----
first written more stringent to ensure xxx is not null
------ For reference only ------------------- --------------------
no any difference !
------ For reference only ------------------------------ ---------
no difference
------ For reference only ------------------------ ---------------
beans flavored with aniseed fennel word has several written
------ For reference only ----------- ----------------------------
no difference
------ For reference only ---- -----------------------------------
but I was head of the latter scolded - - said to be like the first to write tangled as it ~ ~ ~ depressed
------ For reference only --------------- ------------------------
your head may not be familiar , you should not criticize
But since the curse , and you do not get angry , because he was not familiar
------ For reference only -------------------- -------------------

encounter an unfamiliar java head no way
------ For reference only - -------------------------------------
I 've seen this before , it should be like the first One way to write , but I also do not forget the reason, heroes come popularize it.
------ For reference only -------------------------------------- -
XXX What is a variable ? Or something else ?
------ For reference only -------------------------------------- -
not the same thing ......
------ For reference only ---------------------------- -----------
did not make any difference.
------ For reference only -------------------------------------- -
no difference
------ For reference only -------------------------------- -------
1. java library to see how the code is written. Such as the String class ,

 public static String valueOf(Object obj) {
        return (obj == null) ? "null" : obj.toString();
    }

2.http :/ / www.google.com.hk / codesearch, search for null! = lang: java, see everyone is how to write .
------ For reference only -------------------------------------- -
lacks distinction , do not be too harsh
------ For reference only --------------------------- ------------

variables must be of ~ ~

------ For reference only ---------------------------------- -----
tomorrow Results posted ~
------ For reference only -------------------------- -------------


agree

some people when his head, but his stomach no goods, we had to take this stuff to scare people want to use this tree Granville
------ For reference only ------ ---------------------------------
no difference.
------ For reference only -------------------------------------- -
this thought ! good landlord ah

------ For reference only ---------------------------------- -----
may be the norm , constants in the former, the variable in the post.
------ For reference only -------------------------------------- -
prevent programmers write omission equals cause errors. null! = XX so less ! Will be given. The XX! = null less ! Would not be a
------ For reference only ---------------------------------- -----
this thought ! good landlord ah
------ For reference only --------------------- ------------------
are not equal this method. .
this method are different.
you such wording . There should be no distinction between the bar. .
look at the following answer
------ For reference only ------------------------- --------------
crap , i = 5 into if there is not an error ? !



------ For reference only ---------------------------------- -----
java in writing no difference between these two

------ For reference only ---------------------------------- -----
constant in the former, the variable in the post.
------ For reference only -------------------------------------- -
from meaning there will be no difference from the norm in terms of programming , the first one was written in order to prevent write : null = xxx
------ For reference only ------ ---------------------------------
on the landlord to raise this issue , it should be possible Both spellings .
A situation like this:
object A.equals ("") is usually best written as "". equals (A), because A If null, easy throws NullPointerException
- ---- For reference only ---------------------------------------
in some cases, the latter returns a null pointer , you try , and the first one that does not report a null pointer error
------ For reference only ------------- --------------------------
generally the case, but is used to determine equal "==" , the use of null == xxx, to prevent the == mistakenly written as an assignment =
As ! = no need to be so entirely designed ! The effect is the same, you really ***** head .
------ For reference only -------------------------------------- -
first written wording better than the second , most of the actual item inside the code is written with the first one , the first than the second rigorous
------ For reference only ---------------------------------------
String sss = null
sss == null and null == sss no difference

obj.someMethod () == null and null == obj.someMethod () there is a difference
because obj is null null pointer exception thrown when the former , the latter will not

landlord know ?
------ For reference only -------------------------------------- -
seems no different
------ For reference only ------------------------------- --------


think about it, is that right ?
Do not fraught

if obj is null, no matter what the wording will be free pointer ; if obj is not null, will perform two written someMethod method, so if the first way to write empty pointer exception , then certainly the second wording will empty pointer exception , two written simply no difference



------ For reference only ---------------------------------- -----
fact, no difference is the first one can prevent you ! Forget about because you have forgotten ! a compilation error will not logical errors. So easy correction
------ For reference only ---------------------------------- -----


This is the difference
------ For reference only ------------------------------- --------
c / c + + , there are conditions to prevent the judge erroneously written assignment function , java there is no difference
------ For reference only -------- -------------------------------
null! = xxx and xxx! = null does not difference
"abc". equals (xxx) and xxx.equals ("abc") differentiated
------ For reference only ---------- -----------------------------
no difference between right
------ For reference only --- ------------------------------------
only to prevent a typo put it like 23 F . Constant = variable , because the variable = constant correction seems to be forever really that much trouble ,
------ For reference only ------------------- --------------------
we habitually use the first to write side , such an approach is not easy to go wrong when a value is null , may be judged often being given , it should be placed in front of the null , so even if a variable is null behind not being given in the specific practice if there is such a mistake can think about is not for this reason
------ for reference only ---------------------------------------
no difference
------ For reference only --------------------------------------- < br> on your head over some of the java Refbacks Division, Jean Hall and there were discussed the issue because in order to avoid major mistakes xxx is the variable with the former, it is not easy to make mistakes ; the compiler will complain even if error this error is mainly down " ! " No. but the second , then you forget the compiler will not complain if I do not know , oh so tell whether you can understand

------ For reference only ---------------------------------- -----
well, yes, that rigor , the first one is better
------ For reference only ----------------- ----------------------
this is mainly compile time error, for example, to determine whether x is equal to 1, there are two kinds of writing : x == 1 , 1 == x, but sometimes we wrong wrote x = 1,1 = x, which is the former wording of x = 1 is not being given , so it is difficult to find such an error , if it is behind a species , then the compiler will complain . So this is a matter of habit , usually develop 1 == x This style of writing is good.
------ For reference only -------------------------------------- -
  This reply was moderator deleted at 2011-04-25 10:11:14

------ For reference only ---------------------------------- -----
Oh, did not know there is this problem , really gain it.
------ For reference only -------------------------------------- -

so. Afraid == mistakenly written = , such as

if(val==null){/*...*/}
written
if(val=null)//不会报错

However, if the null EDITORIAL will error :
if(null=val)

------ For reference only ----------------------------------- ----
"if (val = null) / / will not complain ."


do not know is not terrible, terrible is opinionated

Will you go to try to see an error, Lv eggs


------ For reference only ---------------------------------- -----
haha. That is certainly differentiated learning PHP and C + +, JS 's
------ For reference only ------------------------- --------------
  This reply was moderator deleted at 2011-04-25 09:15:07

------ For reference only ---------------------------------- -----
If you are a java programmer, both the wording did not make any difference , of course, if you are a C / C + + is another matter , the former written in C / C + + is more robust !
------ For reference only -------------------------------------- -
use the first method if the wrong JDK can check it out. Better. Like sometimes if (x == 1) accidentally wrote if (x = 1) this is not an error. . Khan but also find their investigation . . . But written if (1 = x) the error because constants can not be directly assigned
------ For reference only --------------- ------------------------
first one is the most formal wording
------ For reference only --- ------------------------------------
 roof
------ For reference only ---------------------------------------
no difference , the head if you want to to how to how, head saying is not "wrong " drop
supplement , java is no difference , c / c + + is a difference drops
------ For reference only -------------------- -------------------


this is the java will complain , but most other languages ​​do not it, so encourage more rigorous way !
------ For reference only -------------------------------------- -
both written in C # which is wrong it
------ For reference only ---------------------- -----------------
null! = xxx and xxx! = null differentiated it !
I have encountered such a problem
with xxx! = null runtime error
then replaced with null! = xxx is not being given .

------ For reference only -------------------------------- -------
is to avoid null pointer chant ! Such a simple question . . Egg pain
------ For reference only ------------------------------------ ---


very responsible to tell you two ways for writing a null pointer exception will not

a null pointer exception was written by the equals method
------ For reference only ------------------- --------------------
guess you were born leader is C + + , C + +, in order to avoid if being assigned to write null! = ; x, in java and c # can only exist if the Boolean type , there is no problem.
------ For reference only -------------------------------------- -

sense ......
------ For reference only -------------------------- -------------
prevent leakage write ! result in an error
Similarly xxx == null should be written as null == xxx
------ For reference only --------- ------------------------------

top "if (val = null) / / will not complain " 51 F wrote java compiler used it
------ For reference only ------------- --------------------------

Ah you put that contact to me, I can help you Masi Zhesi !
------ For reference only -------------------------------------- -
wrong people reply Intuit more ......

do not do not play .....
------ For reference only ------------------------ ---------------


estimated that the brothers have not used eclipse ....
------ For reference only ----------------------- ----------------
in fact, it says if (val = null) does not complain is possible

Boolean b = null;
if (b = null);


so the future is not compiled in JDK1.5 error , but is a special case of the

------ For reference only ---------------------------------- -----
forehead , looks like I've also run into xxx! = null on the error , later changed to null! = xxx is not being given . Well , in order to rigorous proposals null! = Xxx it.
------ For reference only -------------------------------------- -
71 F
you have not tried
Boolean b = null;
if (b = null);

this is right for you ?
------ For reference only ------------------------------------ ---
  This reply was moderator deleted at 2011-04-25 13:30:26

------ For reference only ---------------------------------- -----
real time with the development of the first, second there may be a null pointer exception
------ For reference only ------------ ---------------------------
null! = XXX never come this way null pointer exception. Extreme Programming is also suggested wording
------ For reference only ------------------------------ ---------
this is a historical problem, now is not the problem
------ For reference only ----------------- ----------------------



+ +
------ For reference only --------------------------------- ------
course is the first friends. . This can be very convenient error. .
can not be left as NULL values ​​, so when you ! = Wrong when you can easily being given . . .
------ For reference only -------------------------------------- -
do not use c or c + + to look upon java

if (a = 1) {
  //这里是c/c++, 不会报错的, 而你的本意是想判断a是否等于1, 你应该写成a == 1。 为了让编译器提醒你,你写成1 == a 最好了, 如果你忘了写一个=号, 比如 1=a, 这时候是会报错的, 而a=1不会报错
}




if (a = 1) {
   // 这里是java, 编译器直接报错了, 所以各位javaer, 在写"=="表达式的时候不要把变量写在前面了, OK? 要知道java是很强大的, 你写1 == a 和 a == 1没有任何区别, 这2个表达式哪一个少写等号直接报错了
}



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

compile correct runtime exception (NPE)
------ For reference only --------------- ------------------------


Most of the people like to write is parroting or c / c + + legacy wording

in java, xxx == null looked more comfortable , as well as " {" not a single new line

such wording in java, very alternative

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


People are not saying java language . C, C + + Of course, you can write


if (i = 5)

it.
------ For reference only -------------------------------------- -
constants can not be assigned , therefore null == xxx, if == mistakenly written = , then the compiler will pass ! Just a good habit to prevent obscure bug produces
------ For reference only ------------------------- --------------
norms
------ For reference only ------------------- --------------------
class A
{
public:
explicit A (int * a): m_a (NULL) {}

bool operator == (int * const a) const {
return (m_a == a);
}

private:
int * m_a;
};
------ For reference only -------------------------------- -------
with the first good
------ For reference only ---------------------- -----------------

no difference
------ For reference only -------------------------------- -------
order to prevent you from accidentally put "== " instead of " =" , such as:
If you write if (null = obj) it is certainly not pass compiled.
If you write if (obj = null) that can be compiled through . You can hardly find such errors .

But in the final analysis , just a habit.
------ For reference only -------------------------------------- -
landlord is not to ask fennel beans have several written ?
------ For reference only -------------------------------------- -
first wording is strictly prohibited ah good writing style
java inside if (p = null) ... is not being given
I decided to put on the left to avoid the constant low-level errors committed
------ For reference only --------------- ------------------------
I only know a little bit of norms "". equals () try to make you their values ​​on the back
------ For reference only -------------------------------- -------

Ma Wan have to explain why you ?
------ For reference only ---------------- -----------------------
estimate is between JAVA and other language problems, but writing specifications or not, I have more vegetables, waiting for you.
if (val = null) in java is definitely wrong .

------ For reference only ---------------------------------- -----
js you say is right, I think you might be understood backwards - because if (i == 5) and if (i = 5) is not an error, it 's likely to occur typo bug, but if you use the first way to write , even if the programmer to 5 == i write 5 = i , and will generate an error , thus avoiding the occurrence of clerical errors .
------ For reference only -------------------------------------- -
think Wan pressed the hand a little shiver is what results a =

------ For reference only ---------------------------------- -----
absolutely no difference
------ For reference only -------------------------- -------------
order to prevent

xxx == null written in the wrong

xxx = null

! = what will be written in the wrong ?
Haha
------ For reference only --------------------------------- ------
if (xx = null) will not complain ?
tested to answer , OK?
Here java
------ For reference only ---- -----------------------------------
no basic difference between friends do not worry about this

for loop to print the triangle problem

 This post last edited by the jiangjiewudi on 2013-11-21 14:29:17

**
******
**********
**************
*****************
java print as shown in the graph ( two triangles connected ) , seeking answers. Really can not think of a solution. . .
------ Solution ---------------------------------------- ----
2 of their own change it not to end up
public class Test{ 
public static void main(String[] args) { 
printDengYao(5,9);//打印等腰三角形 

public static void printDengYao(int yao,int di){ 
if(di%2==0){
di+=1;

for(int i=0;i<yao;i++){
 
for(int j = 0;j<di/2-i;j++){ 
System.out.print(" "); 
}

for(int k=0;k<=2*i;k++){ 
System.out.print("*"); 

  for(int n = 0;n<2*(di/2-i);n++){ 
System.out.print(" "); 
}
for(int m=0;m<=2*i;m++){ 
System.out.print("*"); 

System.out.println();

}
}

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

        int h = 5;//高度
        h--;
        int l = 4 * h;
        for (int i = 0; i <= h; i++) {
            for (int j = 0; j <= l; j++) {
                if (j >= h - i && j <= h + i || j >= 3 * h - i && j <= 3 * h + i) {
                    System.out.print("*");
                } else {
                    System.out.print(" ");
                }
            }
            System.out.println();
        }

------ For reference only ------------------------- --------------
these problems can be attributed to two-dimensional array of issues
------ For reference only --------- ------------------------------
Thank you for reminding !
------ For reference only -------------------------------------- -
public class Test{ 
public static void main(String[] args) { 
printDengYao(5,9);//打印等腰三角形 

public static void printDengYao(int yao,int di){ 
if(di%2==0){
di+=1;

 
for(int i=0;i<yao;i++){ 
for(int j = 0;j<di/2-i;j++){ 
System.out.print(" "); 
}
for(int k=0;k<=2*i;k++){ 
System.out.print("*"); 

System.out.println();

}
}

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


The two triangles , not one. . .
------ For reference only -------------------------------------- -
two-dimensional array how to write ?
------ For reference only -------------------------------------- -
two triangles connected to the corner is a coincidence , how to write ?
------ For reference only -------------------------------------- -
two triangles connected to the corner is a coincidence , how to write ?  

What do you mean ? What angle coincidence ? me are ok ah

------ For reference only ----- ----------------------------------
two triangles connected to the corner is a coincidence , this how write ?          
  
What do you mean ? What angle coincidence ? me are ok ah   
        is the lower right triangle to the left of the " *" and the right of the lower left corner of the triangle "*" share a .
------ For reference only -------------------------------------- -
upstairs can ah. What coincidence ?
------ For reference only -------------------------------------- -

public class Test{ 
public static void main(String[] args) { 
printDengYao(5,9);//打印等腰三角形 

public static void printDengYao(int yao,int di){ 
if(di%2==0){
di+=1;

for(int i=0;i<yao;i++){
 
for(int j = 0;j<di/2-i;j++){ 
System.out.print(" "); 
}

for(int k=0;k<=2*i;k++){ 
System.out.print("*"); 

  for(int n = 0;n<2*(di/2-i)-1;n++){ 
System.out.print(" "); 
}
if(i<yao-1)
{
for(int m=0;m<=2*i;m++){
System.out.print("*");
}
}
  else
  {
  for(int o=0;o<=2*i-1;o++){
System.out.print("*");
}
  }
System.out.println();

}
}


carefully counted before we know what you mean, you want a second triangle left one , plus a judgment on o it. . .

struts2 tag library iterative problem

iteration List, I generally every iteration of a record two records each iteration now , how to get it, please help Big Brother Big Sister , thank you ! ! !
example ah :





$ {beaninfo.productId}
;





so that each time a record out , and then the next iteration ,
But now I want to come up every two records out, and then the next iteration





$ {beaninfo.productId}
;

$ {beaninfo.productId}
;





how to get it, Big Brother Big Sister help , thank you ~ !
------ Solution ---------------------------------------- ----
can use an iteration variable temporary storage , the second time without iteration result , the direct use of this temporary ?
------ Solution ---------------------------------------- ----
should consider other ways to go around .
------ Solution ---------------------------------------- ----
two td contents of the same, I do not know why you want to ,

this way you can achieve what you want



$ { beaninfo.productId}



$ { beaninfo.productId}
;




do not know if . .
------ For reference only -------------------------------------- -
Forums bad one morning
------ For reference only ----------------------------- ----------
Thank you for your answer .
------ For reference only -------------------------------------- -
landlord you how to solve ah

Java inner class a compilation error , help me find

I use Netbeans + jdk1.7 wrote a very small program :

public class JavaApplication1 {

    /**
     * @param args the command line arguments
     */
    public class Base
    {
        public Base() { f(); }
        public void f() { System.out.println("Base"); }
    }
    public class Derived extends Base
    {
        public Derived() { f(); }
        public void f() { System.out.println("Derived"); }
    }
    public static void main(String[] args) {
        // TODO code application logic here
        JavaApplication1.Base pb = new JavaApplication1.Derived();
    }
}

main function prompts the only word there is an error , "non-static variable cannot be referenced from a static context. May split declaration into a declaration ; and assignment ".

This in the end is what does this mean ?
------ Solution ------------------------------ --------------
public class Base
amended as follows:
public static class Base


Derived too.
------ Solution ---------------------------------------- ----
line 18 :
JavaApplication1.Base pb = new JavaApplication1.Derived ();

you write that part of the right side of the equal sign is used to define a static inner classes .


To define general internal class , should be written as :
JavaApplication1 ja1 = new JavaApplication1 ();
JavaApplication1.Base pb = ja1.new Derived ();

try it ~
defines common internal class object must have a peripheral (such as in this case JavaApplication1 class ) corresponding object .



------ Solution ------------------------------------ --------
because it is in the peripheral category (JavaApplication1) inner class defined inside the object , so can even be simplified to :
JavaApplication1 ja1 = new JavaApplication1 ();
Base pb = ja1.new Derived ();
------ Solution -------- ------------------------------------
Base Derived now JavaApplication1 outside the try.
------ Solution ---------------------------------------- ----
public class Base
amended as follows:
public static class Base


Derived too. quote 1 floor

in a static method can not call non-static methods

2013年11月20日星期三

Help , eclipse + tomcat startup projects already stuck in the starting state

public then click on start, then show tomcat starts normally, but the projects remain in the starting state is always the state , has been tested at this time service is not started
If you put aside eclipse, under the direct start tomcat startup.bat, then start normal
in eclipse occurs starting state, calling netstat-ano find the default 8080 port is occupied , the display SYN_SENT state ,
In the process, there is always a cmd.exe repeatedly loaded exit , ask possible causes
PS: have to say off the firewall , but under windows7 due to the company 's anti-virus software installed in the computer , only in the Advanced Settings - Firewall Properties closed , do not know that there is no relationship
------ Solution --------------------------------------------
estimated eclipse What is missing plug-ins or configure a problem , you might consider another try eclipse try
------ For reference only --------------------- ------------------
stay for how long, and in the process there is no error stay , stay the process of how the state of the CPU and memory to run , have not changed in the works try. . . .
------ For reference only -------------------------------------- -
I put the start time is set to unlimited, it has been stuck , in addition to the state of the CPU and memory has been described , is to have a cmd constantly flashed , I feel it is the service after , eclipse always scan corresponding port , but have never received feedback
------ For reference only ---------------------------- -----------
the server works Qingdiao try , see if it works or tomcat eclipse problem or question , gradually narrowing the scope of the problem ought to solve the problem
--- --- For reference only ---------------------------------------
should not be tomcat question, because I directly under the tomcat startup.bat is activated , in addition, you can see the eclipse view netstat always asking after the start port 8080 , so that has caused 8080 card syn_sent state
------ For reference only --------------------------------------- < br> then you go to determine the next is eclipse or web engineering problems
------ For reference only ------------------------ ---------------
determine the eclipse of the problem, because this project we are using , as far as I go wrong
------ For reference only - -------------------------------------
I feel is the eclipse of the problem, and now the project tight will use the bar , take a look back over time around the environment
------ For reference only -------------------------- -------------
I have been having this problem for a moment today to set a proxy eclipse will be solved .
Active Provider chosen Manual
Internet proxy settings look

proxy bypass are three :

localhost
127.0.0.1
------ For reference only ------------------------------- --------
9 F positive solution !
------ For reference only ---------------------------------------


you can say in detail what I have encountered this problem
------ For reference only ------------------ ---------------------

  
you can say in detail what I have encountered this problem  

window> preferences> In the input box , enter the proxy on the line

Why does my hair stick Nobody back ah


Is it because avatar ugly , it does not I changed avatar
,
By the way, why I can only give a maximum of 100 points , and I saw some gave 300
------ Solution -------------- ------------------------------
that you are too beautiful.
------ Solution ---------------------------------------- ----
know why not ?
landlord dishonest , and then have to use their own ugly way .


------ Solution ------------------------------------ --------
landlord can send in irrigation park, where many people reply
------ Solution - -------------------------------------------
very nice to say ah

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

------ Solution ---------------------------------------- ----
landlord too wretched < br> ------ Solution ----------------------------------------- ---
landlord, I 'm ready !
------ Solution ---------------------------------------- ----
seems to a certain level , and posting scores before they can add up .
------ Solution ---------------------------------------- ----
me to look at. . .
------ Solution ---------------------------------------- ----
level is not enough
------ Solution - -------------------------------------------
on Red Star diamond can plus
------ Solution -------------------------------------- ------

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

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

I've learned people come purely to loose points. By the way, ask my second question
------ For reference only ----------------------------- ----------
take a man scared
------ For reference only ------------------- --------------------
I also think that , if I then also used as program apes do, long to find a high rich handsome
- ---- For reference only ---------------------------------------
oh Oh, it went irrigation try
------ For reference only ------------------------------- --------
oh , that try to irrigation  
originally sister paper

2013年11月19日星期二

About jxl export excel "File error that may have lost some of the data format "

This is two days doing a statistical report , with jxl export excel file, open the file , always pop up a message box saying " file error , you may have lost some of the data format ." Depressed for a long time, has not found solutions, Internet search, find many information , some say excel template version of the problem, but I tried 2007, 2003 , or save it as 97-2000 , I have tried, but or useless , hoping Which predecessors , experts encountered a favor ! !
------ Solution ---------------------------------------- ----
landlord I tried it , I guess it should be a problem jxl library .

solution.

excel () method in
WritableWorkbook wwb = wb.createWorkbook (baos, wb); phrase into the following three .

WorkbookSettings settings = new WorkbookSettings ();  
settings.setWriteAccess(null); 
WritableWorkbook wwb = wb.createWorkbook(baos, wb, settings);

http://blog.csdn.net/deng11342/article/details/7479136


------ For reference only ---------------------------------- -----
paste the code look ?
Or use poi try.
------ For reference only -------------------------------------- -


This is what I do in the dormitory test code :
@ Override
protected void doPost (HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {

res.setContentType ("application / msexcel; charset = GBK");
res.setHeader ("Content-Disposition", "attachment; filename =" +
"aa.xls");

InputStream in = this.excel ();
OutputStream out = res.getOutputStream ();
byte [] b = new byte [1024];
int i = 0;
while ((i = in.read (b))> = 0) {
out.write (b, 0, i);
}
out.flush ();
in.close ();
out.close ();
}

public InputStream excel () {
List list = new ArrayList ();
list.add ("one");
list.add ("one");
list.add ("one");
list.add ("two");
int x = 0; / / write from the first few lines

File file = new File ("D :/ / 22.xls"); / / template file
try {
Workbook wb = Workbook.getWorkbook (file);
ByteArrayOutputStream baos = new ByteArrayOutputStream ();
WritableWorkbook wwb = wb.createWorkbook (baos, wb);
WritableSheet sheet = wwb.getSheet (0);
for (int i = 0; i Object value = list.get (i);
sheet.addCell (new Label (i, x, list.get (i)));

}

wwb.write ();
wb.close ();
wwb.close ();
return new ByteArrayInputStream (baos.toByteArray ());
} catch (Exception e) {
e.printStackTrace ();
}
return null;
}
------ For reference only --------------------------------- ------

buddy ! That way you can do ? I tried it , or not ! But thank you ! !
------ For reference only -------------------------------------- -
true or not, no one can explain it to write a proper
------ For reference only --------------------- ------------------
I have encountered this problem, but I just did a little test , have found the problem , it is best to use the 2003 template , and then in 2003 which modify the template can not be 2003 or 2010 and then in 2007 to modify the inside , so that will not work, or when exported will complain , and you use 2003 as a template to modify the exported after a good try, I just tested already, because I was 2003 before the template, and then the machine installed in 2010 , and on this unit to modify the template , and then export the file data format , they reported missing
----- - For reference only ---------------------------------------
ask how to solve I have encountered, upstairs methods are tried or a problem. Find a sample , the easiest export import templates , no problem. I put the sample code and jxl package into my project where there are problems . What really can not think why. And other packages will be because of conflict? Such as poi what ?
Workbook wb = Workbook.getWorkbook (new File ("C: \ \ Users \ \ Desktop \ \ JExcel \ \ JExcel \ \ Template.xls"));

WritableWorkbook book = Workbook.createWorkbook (new File ("C: \ \ Users \ \ Desktop \ \ JExcel \ \ JExcel \ \ NV1.xls"), wb);
book.write ();
book.close ();
wb.close ();
------ For reference only ---------------------------- -----------
I just installed a 2003 special , but not, although files can be displayed properly , it can normally be used, but are prompted each time you open that , I feel very uncomfortable

------ For reference only ---------------------------------- -----
installed on the computer with their own version of office excel create the target , paste the contents of the original template . I tried to be ...
------ For reference only ---------------------------------------
create a template . . . I went to this input method is good Meng . .

Will Java how to achieve cross-server file upload ?

Will Java how to achieve cross-server file upload ?

file information is stored in a web server database file is saved in another machine .
------ Solution - -------------------------------------------
WEBservice Interface should be
------ Solution -------------------------------------- ------
how to understand cross-server file upload it ?
general document on the web service where the container , the file path information is saved to the database, the path taken by loading the file .
------ Solution ---------------------------------------- ----
certainly this demand ah ! If I could get a dedicated file server storage resources ?
------ Solution ---------------------------------------- ----
landlord resolve Results posted when I remember sharing Guixie ~
------ Solution --------------------- -----------------------
via FTP to upload files to the server, and then save the path into the database .
------ Solution ---------------------------------------- ----
I can think of is : Can you get a special way , incoming file server ip address, so go read the file server 's file system.
------ Solution ---------------------------------------- ----
top, I would like to know .
------ Solution ---------------------------------------- ----
5 Floor positive solution . Want to upload files to another separate file server, you must use FTP to do .
------ Solution ---------------------------------------- ----
the easiest way is to make a disk mapping , the file server's disk is mapped to the web server. Then taken in a local directory with the web server .
------ Solution ---------------------------------------- ----
we use controls do . Pass directly to the storage server above .
------ Solution ---------------------------------------- ----
2 Floor positive solution of data between systems webservice can call
------ Solution --------------------- -----------------------
our system is thrift frame.
------ For reference only -------------------------------------- -
3K, currently using FTP mode , time studies Web Service. . .
------ For reference only ---------------------------------------
is the user uploaded files can be saved A single server in which you can save on the B server , etc., but the application only exists in a single server.
------ For reference only -------------------------------------- -
certainly this demand ah ! If I could get a dedicated file server storage resources ?   file server. . .
------ For reference only -------------------------------------- -
record for a moment, you can look at : http://blog.csdn.net/for_china2012/article/details/16820607
------ For reference only -------- -------------------------------
certainly this demand ah ! If I could get a dedicated file server storage resources ?   record for a moment, you can look at : http://blog.csdn.net/for_china2012/article/details/16820607
------ For reference only -------- -------------------------------
landlord resolve Results posted when I remember sharing Guixie ~   you go and see : http://blog.csdn.net/for_china2012/article/details/16820607
------ For reference only ----------- ----------------------------
general document on the web service where the container , the file path information is saved to the database , load when the path taken by the file . --- Positive solution, you said cross-server , in fact, to interact with the interface .
------ For reference only -------------------------------------- -
present in this way , but still have to study a another method. . .
------ For reference only ---------------------------------------
record a bit, you can see look : http://blog.csdn.net/for_china2012/article/details/16820607
------ For reference only ------------------- --------------------
FTP is not required , Java implemented in a variety of ways . . .

White distress DAO problem

ICustomerDAO.getaa ()
DAO method inside a short sale with a pointer to the next configuration file check did not find anything wrong Mongolia laps
Here is all the code


CustCustomerAction.java

import java.io.Serializable;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONObject;

import org.apache.struts2.interceptor.ApplicationAware;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;
import org.hibernate.criterion.Restrictions;

import com.javalines.hibernate.dao.base.IBaseDAO;
import com.javalines.hibernate.dao.cust.ITbCustCustomerDAO;
import com.javalines.hibernate.page.EntityView;
import com.javalines.hibernate.pojo.cust.TbCustCustomer;
import com.javalines.struts2.action.base.BaseAction;
import com.javalines.util.AjaxUtils;

public class CustCustomerAction extends BaseAction<TbCustCustomer> implements
ServletRequestAware, ServletResponseAware, SessionAware,
ApplicationAware {
public final static String ID_LIST_PARAM = "idList";
public final static String PAGE_NUM_PARAM = "nowPage";
// request
protected HttpServletRequest request;
// response
protected HttpServletResponse response;
// HTTP session
protected Map<String, Object> session;
// application
protected Map<String, Object> application;
private ITbCustCustomerDAO ICustomerDAO;

public ITbCustCustomerDAO getICustomerDAO() {
return ICustomerDAO;
}

public void setICustomerDAO(ITbCustCustomerDAO customerDAO) {
ICustomerDAO = customerDAO;
}

public void setApplication(Map<String, Object> arg0) {
this.application = arg0;
}

public void setSession(Map<String, Object> arg0) {
this.session = arg0;
}

public void setServletResponse(HttpServletResponse arg0) {
this.response = arg0;
}

public void setServletRequest(HttpServletRequest arg0) {
this.request = arg0;
}


public IBaseDAO<TbCustCustomer, Serializable> getEntityDAO() {
// TODO Auto-generated method stub
return null;
}

public void checkLoginName(){
try{
String username = request.getParameter("username");
System.out.println(ICustomerDAO.getaa());

AjaxUtils.renderJson(json);
}catch(Exception e){
e.printStackTrace();
}


}




struts_mall.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="mallPkg" extends="struts-default" namespace="">
<interceptors>
<!-- 定义拦截堆栈 -->
<interceptor-stack name="myDefault">
<interceptor-ref name="defaultStack"></interceptor-ref>
</interceptor-stack>
</interceptors>
<!-- 定义预定义堆栈 -->
<default-interceptor-ref name="myDefault"></default-interceptor-ref>
<!-- 定义全局结果集 -->
<global-results>
<result name="login">../mall/buyerLogin.jsp</result>
<result name="error">/base/500.jsp</result>
<result name="vcellException">/base/vcellException.jsp</result>
<result name="vcell.invalid.token">/base/duplicateSubmit.jsp</result>
</global-results>
<!-- 配置拦截器完成 -->
<!-- 配置全局异映射 -->
<global-exception-mappings>
<exception-mapping result="error" exception="java.lang.NullPointerException"></exception-mapping>
<exception-mapping result="error" exception="java.lang.ArithmeticException"></exception-mapping>
<exception-mapping result="error" exception="java.lang.Exception"></exception-mapping>
<exception-mapping result="vcellException" exception="com.javalines.system.VCellException"></exception-mapping>
</global-exception-mappings>

<action name="CustCustomerAction" class="com.javalines.struts2.action.cust.CustCustomerAction">
<result name="success">/result.jsp</result>
</action>

</package>
</struts>




ITbCustCustomerDAO.java


import java.io.Serializable;

import com.javalines.hibernate.dao.base.IBaseDAO;
import com.javalines.hibernate.pojo.cust.TbCustCustomer;
public interface ITbCustCustomerDAO extends IBaseDAO<TbCustCustomer,Serializable> {
public String getaa();
}




TbCustCustomerDAOImpl.java


import java.io.Serializable;

import com.javalines.hibernate.dao.base.BaseDAO;
import com.javalines.hibernate.pojo.cust.TbCustCustomer;

public class TbCustCustomerDAOImpl extends BaseDAO<TbCustCustomer,Serializable> implements
ITbCustCustomerDAO {

@Override
public Class<TbCustCustomer> getEntityClass() {
return TbCustCustomer.class;
}

public String generateCodeForApp(String type) {
// TODO Auto-generated method stub
return null;
}

public String generateCodeForCoupon(String type) {
// TODO Auto-generated method stub
return null;
}

public String generateCodeForCouponPurse(String couponNum, String type) {
// TODO Auto-generated method stub
return null;
}

public String generateNumForCoupon(String type) {
// TODO Auto-generated method stub
return null;
}

public String getaa(){
return "bb";
}
}






applicationContext_mall.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

   
    <bean id="CustCustomerAction" scope="session" class="com.javalines.struts2.action.cust.CustCustomerAction">
    <property name="ICustomerDAO" ref="TbCustCustomerDAOImpl"></property>
    </bean>
   <bean id="TbCustCustomerDAOImpl" class="com.javalines.hibernate.dao.cust.TbCustCustomerDAOImpl">
<property name="hibernateTemplate" ref="ht"></property>
</bean>
</beans>

------ Solution ------------------------------------- -------
given problem may be the size of the
private ITbCustCustomerDAO ICustomerDAO;
changed
private ITbCustCustomerDAO i CustomerDAO;
try
------ Solution ---------------------------------- ----------
System.out.println (ICustomerDAO.getaa ());
exception phrase it.
ICustomerDAO certainly not object instantiation .
ICustomerDAO is where the injected ?
------ Solution ---------------------------------------- ----
landlord ah you simply can not give spring action management course, not injected . You struts.xml inside
/ result.jsp

This action is generated by the object factory struts2 not use spring object factory that generates course not injected , struts.xml plus
then CustCustomerAction ">
/ result.jsp

Here's class , you can use that action spring configuration inside the beanId the
------ For reference only ------------------- --------------------
reported abnormal hair also look under the
------ For reference only ------- --------------------------------
mediated one is no exception in the try catch ; catch exceptions ... see

java.lang.NullPointerException
at com.javalines.struts2.action.cust.CustCustomerAction.checkLoginName (CustCustomerAction.java: 72)
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 com.opensymphony.xwork2.DefaultActionInvocation.invokeAction (DefaultActionInvocation.java: 440)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly (DefaultActionInvocation.java: 279)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 242)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept (DefaultWorkflowInterceptor.java: 163)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (MethodFilterInterceptor.java: 87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept (ValidationInterceptor.java: 249)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept (AnnotationValidationInterceptor.java: 68)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (MethodFilterInterceptor.java: 87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept (ConversionErrorInterceptor.java: 122)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept (ParametersInterceptor.java: 195)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (MethodFilterInterceptor.java: 87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept (ParametersInterceptor.java: 195)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (MethodFilterInterceptor.java: 87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept (StaticParametersInterceptor.java: 148)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept (CheckboxInterceptor.java: 93)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept (FileUploadInterceptor.java: 235)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept (ModelDrivenInterceptor.java: 89)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept (ScopedModelDrivenInterceptor.java: 128)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept (ProfilingActivationInterceptor.java: 104)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept (DebuggingInterceptor.java: 267)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept (ChainingInterceptor.java: 126)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept (PrepareInterceptor.java: 138)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (MethodFilterInterceptor.java: 87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept (I18nInterceptor.java: 148)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept (ServletConfigInterceptor.java: 164)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept (AliasInterceptor.java: 128)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept (ExceptionMappingInterceptor.java: 176)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at org.apache.struts2.impl.StrutsActionProxy.execute (StrutsActionProxy.java: 52)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction (Dispatcher.java: 468)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter (FilterDispatcher.java: 395)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java: 235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java: 206)
at net.bull.javamelody.MonitoringFilter.doFilter (MonitoringFilter.java: 381)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java: 235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java: 206)
at org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java: 233)
at org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java: 191)
at org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java: 127)
at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java: 102)
at org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java: 109)
at org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java: 298)
at org.apache.coyote.http11.Http11AprProcessor.process (Http11AprProcessor.java: 859)
at org.apache.coyote.http11.Http11AprProtocol $ Http11ConnectionHandler.process (Http11AprProtocol.java: 579)
at org.apache.tomcat.util.net.AprEndpoint $ Worker.run (AprEndpoint.java: 1555)
at java.lang.Thread.run (Thread.java: 619)
------ For reference only ------------------ ---------------------

xml inject instantiation seems to be right from the factory to instantiate white confused ah
------ For reference only ---------------------------------------


really big thank god