This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
How can test a jsp that use the tag of spring and the controlle exends the simpleformcontroller of my webapplicatio but I am not on the network company so I don't find the databes,webservise and other.
Someone can suggest me there is a way??
What you are describing here, including the controllers, application, database, webservices, is not UnitTesting. That sounds very much like an Integration Test to me.
Unit testing the presentation layer is, and always has, been a difficult task. But there are a couple of tools in the kit that we can use.
First off you can use a web testing tool such a Selenium to drive and observe the Browser user interface. These sorts of tools hook into the browser using the xpath, DOM id, or DOM class. The advantage of these sorts of tools is that they're relatively easy to get going with. The downside is that they require a browser to be installed to run and can be quite picky with what browsers and versions they're run with. Another downside is that if you change the UI you may break your tests. This leads your tests to be pretty flakey.
Secondly you can use something like JspTest which will directly test the data being passed up to the presentation layer in the JSP tags. While you are not testing the layout of your UI (which you probably shouldn't be doing anyway) it will test that the required data is being received correctly and for submission data is being sent correctly. You are now testing the functionality of your presentation layer with a Unit Test which is really what we want to be doing. (Disclaimer: I haven't used JspTest, just read about it in Lasse Koskela's Test Driven book).
If you setup your test cases so that the controllers are mocked out then you do not need access to anything beyond that to run your presentation Unit Tests. So lack of network access will not be a problem.