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

Null property values in nested paths relating to <spring:bind> tag, <form:xxx> tags, and ServletRequestDataBinder [SPR-1860] #6554

Closed
spring-projects-issues opened this issue Apr 5, 2006 · 2 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Apr 5, 2006

Arthur Branham opened SPR-1860 and commented

Given: a complex form backing object A which has property B which has property C. (A.B.C)

I have several questions on some issues I have encountered:

  1. Upon an initial visit to a view page using a form:form tag, there will be no form backing object. This results in an exception
    "java.lang.IllegalStateException: Neither Errors instance nor plain target object for bean name 'command' available as request attribute."
    Therefore is it necessary to initially direct the user to an Controller which will create the form backing object and place it in the model under the key "command"? I feel that the form:form tag should handle the case where a form backing object is missing and create it via an optional commandClass attribute or commandBean attribute via the spring bean factory using an id/name. It should then bind the newly created form backing object to requestScope under the "commandName" property specified in the form tag.

  2. Assume I am fowarding from a controller to a view. I have set object 'A' to be part of my model and use the <form:form commandName="A"> on the view page. If a property B in object A is null and is part of a nested path in a tag such as <spring:bind path="A.B.C"> or any of the <form:input path="B.C">, an exception "org.springframework.beans.NullValueInNestedPathException: Invalid property 'B' of bean class [A]: Value of nested property 'B' is null" is thrown.
    There should be some way to fail silently such as in JSTL and simply have status.value return 'null'.

  3. Given a one of the form:input elements with a path of "B.C", assume I submit its value to a MultiActionController. In the controller I must create a new form backing object (which will be A) and bind the servlet request parameters to it using the binder. Since Property B may be null in object A, there is no way that property C can be set since B is null. We need a strategy to instatiate property B in the case where a nested property C is submitted with a value.

What are your suggestions on these issues? I believe most of these issues have been addressed by Struts.


Affects: 2.0 M3

Issue Links:

4 votes, 6 watchers

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Nov 26, 2009

Sam Brannen commented

FYI: point #3 has been addressed in Spring 3.0.0.RC2 (see #10701).

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Closing groups of outdated issues. Please reopen if still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants