Sean Clark

Rancher
+ Follow
since Jul 15, 2009
Sean likes ...
Android Spring Java
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
19
Received in last 30 days
0
Total given
22
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sean Clark

Hey,

Well you can use the @ModelAttribute annotation, however you are still going to need to put that in every controller or create a superclass which has it in it.

Sean
12 years ago
Hey,

You have a number of options open to you, you could:
1) Create a super class which factors out the common code between the 2 methods/classes.
2) Create a CatagoriesService.java class which will provide the common functionality for you and add that in to both classes.
3) If it never changes you could store the attributes in Application Scope so that they are always there. (only really suitable if the data doesn't change!)

Sean
12 years ago
Hey,

Sagar Rohankar wrote:Sean, I'm not changing the standard dir structure. I'm just want to decide where to keep web tests "src/main/java" or "src/test/java"?


You're splitting hairs here, you are wanting to use a standard application code folder to store tests, you are changing what that folder does and therefore I think you are changing the standard directory structure. You would need to configure maven not to pick up your web tests otherwise you would end up with them in your WAR file. More effort than it is worth I feel and that is my suggestion. If you wish to take another route then do.

Sagar Rohankar wrote:yeah, right; but this looks great if my web tests are in same maven project and not located somewhere in dedicated web test project.


If you want to include the tests in another project then you could do that through maven by adding a dependency to your main projects test classes jar (you need to configure it to create a jar for the tests.)

I'm not looking to get into a debate, you asked for suggestions and these are mine, if you don't wish to take any notice then you are welcome to.

Sean
12 years ago
Hey,

My suggestion is to keep with the standard structure for a maven project (see here).
If you don't use these structures you are:
a) Probably going to have to make some configuration changes to maven in order for it to know where the tests are located because you are not using the usual place. (If you're not forced to make changes then why complicate your maven configuration)
b) Make it harder for anyone used to maven as the folders won't be as you would expect in a maven project

In answer to your question 2, you can have your app deployed to the server during the maven build and then run your tests against it all within maven. You can in maven build a jar with your tests in it so if this would be what you needed you can do it as well.

Sean

12 years ago
I'm out of ideas then, it's certainly working from mine.
Just make sure there are no errors coming up when tomcat starts.

Sorry.
Sean
12 years ago
What url are you using?

Sean
12 years ago
Ok got it, should be / and not /*.

I just created a test app with your settings (apart from the sitemesh filter which I commented out and the listener which I did the same as it expects an applicationContext.xml file).

Sean
12 years ago
Hey,

The URL pattern for the servlet is still wrong, it should go from the context root (test-app) so it should be /*.

Sean
12 years ago
Hey,

That shouldn't matter, that's why you have created a viewResolver in your spring configuration and why you have used the <mvc:view-controller /> annotation.
There is however another problem in your configuration that is probably the issue, you have not created Spring's servlet in the web.xml you posted. Therefore Spring will never be initialised.

Sean
12 years ago
Hey,

You should try...
http://localhost:8080/test-app/index it won't find an index.jsp file if you are only pointing at the root...

Sean
12 years ago
Should your web folder not have a WEB-INF folder nested inside it?
Then you would put your container specific file in there?

EDIT - Check here your folder structure should match this. i.e src/main/java, src/main/webapp

Sean
12 years ago
It does say it's not properly supported, so it may work, however you should be doing server side validation regardless as it could be possible to circumvent any client side validation.

Sean
Hey,

Check this link, http://www.w3schools.com/tags/att_input_accept.asp, this attribute is not supported by any major browsers and it also gives a tip that any validation should be done server side.

Hope this helps.

Sean