Win a copy of Head First Android this week in the Android forum!

wei liu

Ranch Hand
+ Follow
since Nov 19, 2008
wei likes ...
Eclipse IDE
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by wei liu

Hi eveyone,

I am planning to study the spring framework, however, I've leaned that the current version is spring3 which has very different from the spring 2.

so My question is: shall I study the most current one, namely Spring 3?
Are most companies in the industry still using the Spring 2?

I have got the Spring in Action 3rd edition, however, I found some of the source code mention in the book are not so complete, can someone study this book give me some hint where to find the source code?

Thanks
10 years ago
I am not sure if my question is best match to here, but I hope someone can provide me the direction to solve this problem

I am writing a web application, there is one function which is to call



to get a xml file as return if you key in the url in webbrowser.

.

I was wondering how to make request in my servlet or JSP page to above web URL and receive the expect xml code from that URL as response either as stream or other form.

thanks in advance for the help.





10 years ago
I myself is java developer, and I have been develop web application for a year now!
I have been prepared the exam for 2 hours per day for two weeks. and I pass the exam with 84% today.

the exam is generally easier than the question in HF mock exam, some of the question you can directly work out
the answers without reading the questions. SO MAKE SURE YOU MEMORIZE THE SYNTAX such as tag in DDs and
APIs.

and again thanks ranchers David Bridgewater who provides a brilliant Summary guide
and Mohammad Albaba who assembly all useful API and DD tags together for memorization.

isn't the Java class will have a default no-args constructors? so do you need to explicitly define this no-arg constructor?
The question and answer in the book is


Q: what should you use if you need mutliple instances of the servlet to share something?

A: if you want all the threads to access a value, decide which attribute state makes the most sense, and store the value in an attribute.
chances are, you can solve your problems in one of the two ways:

1)Declare the variables as local variable within the service method, rather than as an instance variable.
or
2) use an attribute in the most appropriate scope.



my Question is
since we do not overwrite the service() method, how could we declare the variables in the service() mehtod, or does the answer in the book means
declare the variables in the DoGet or DoPost method of my Servlet class?

and

the second approach which is use an attribute, in that case if the attribute is context-attribute or session attribute, I will have to synchronize the
servletContext and httpSession object as well, is that correct?

Thanks
hi everyone,

I am writing a crawler to download webpages but some pages are protected with username/password.

I am trying to use the authenticator to gain access to thoes pages provided with my username/password,but failed

here is my code below


and part of code from my crawler


I noticed by the result that only "MyMinningAuthenticator!!!" is printing out, but not the String "getPasswordAuthentication!!!"
is that means the protected method in MyMinningAuthenticatior is not running.


Thanks
hi everyone,

How to prevent user from visting back using browser "go back button" after signout, I have tried



it did show an page expired page when user trying to go back, however, even when user stay logged in, user will get the "page expire" when using the go back button.

Can anyone give me some clue how to prevent user from goint back to previous page (ideally redirect to login page) after sign out, while user can freely go back to previous page while logined in.


Thanks
11 years ago
JSP

Arpit Panwar wrote:Make sure you change the Storage engine of your table to InnoDB
I think the default engine MyISAM doesnt support Transactions
Try it and let me know



Thanks Arpit, It works after change the engine from MyISAM to InnoDB.

Thanks for your help.

Paul Sturrock wrote:Which database are you using?



I am using Mysql

Ulf Dittmer wrote:What does "it doesn't work" mean? What exactly happens if you run the code?



the entry"123456" and "root" have been inserted into the database which are not supposed to be inserted since the rollback was called!
hi everyone, I wrote a piece of code to test the rollback function.However, it doesn't work, can some one scanning through my code and tell me what the problem is .



Thanks

Bear Bibeault wrote:

wei liu wrote:which only prints 1 which should be 2.


Why would you say that? There is only one Criterions tag in the XML.



You are right, I should use Criterion instead of Criterions. thanks
xml Code is :




I was only able to extract the first Criterion block.

what I am using to extract is :


which only prints 1 which should be 2.

can someone tell me how to extract both of the criterion block from the xml code.

thanks

Eric Pascarello wrote:

You want to use the array notation, not the dot notation






Better yet, you can use an id on the form/element and use getElementById

Eric





Thanks erics, it works.!!