Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation explaining how to enable MatrixVariable in Spring MVC [SPR-11331] #15955

Closed
spring-projects-issues opened this issue Jan 19, 2014 · 7 comments
Assignees
Labels
status: backported An issue that has been backported to maintenance branches type: task A general task
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jan 19, 2014

leebm opened SPR-11331 and commented

example:

@RequestMapping(value = "/hello/{mes}", method = RequestMethod.GET)
	public String hello(
			@PathVariable String mes, Model model, 
			@MatrixVariable int age) {
		model.addAttribute("mes", mes);
		model.addAttribute("age", age);
		return "hello";
	}

url: http://localhost/s3/hello/hi;age=21
this url can't be matched.


Affects: 3.2.6

Issue Links:

Referenced from: commits cfa78a9, 175aa86, 98174e1

Backported to: 3.2.7

@spring-projects-issues
Copy link
Collaborator Author

Stéphane Nicoll commented

I just replicated this code in a test case and it works with master (4.0.1.BUILD-SNAPSHOT).

I am guessing that if you are referring to @MatrixVariable, the same code works without it (i.e. by removing the age parameter and trying to resolve http://localhost/s3/hello/hi). If that's the case, could you please provide the version of Spring that you are using?

Thanks!

@spring-projects-issues
Copy link
Collaborator Author

leebm commented

thanks yours comment!

i'm try this url "http://localhost/s3/hello/hi",but it's still not work.

i'm change to this: @MatrixVariable(defaultValue = "1") int age, url can matched. but "age=21",this age value is not binded.

i'm use spring version 3.2.6.RELEASE.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Jan 20, 2014

Stéphane Nicoll commented

This might be a duplicate of #15664. If you're not using JavaConfig, please make sure that you have enabled the feature:

<mvc:annotation-driven enableMatrixVariables="true"> ...

If that still does not work for you, I might need a bit more info and some representative logs with the full stacktrace that you get.

Thanks!

@spring-projects-issues
Copy link
Collaborator Author

leebm commented

use this config,it's worked ok!

i read docs/3.2.6.RELEASE part of 17.3.2 Matrix Variables,but any content with this config.if enableMatrixVariables default
false,should has some tip?

thank you very much! :)

@spring-projects-issues
Copy link
Collaborator Author

Stéphane Nicoll commented

Yes, you are right, the documentation definitely needs an update in that area. Thanks.

@spring-projects-issues
Copy link
Collaborator Author

Stéphane Nicoll commented

See PR #447

@spring-projects-issues
Copy link
Collaborator Author

leebm commented

ye,it's nice!

@spring-projects-issues spring-projects-issues added status: backported An issue that has been backported to maintenance branches type: task A general task labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.0.1 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: backported An issue that has been backported to maintenance branches type: task A general task
Projects
None yet
Development

No branches or pull requests

2 participants