How to send object as attribute from another JSP object to a Spring controller?

Asked

Viewed 150 times

0

Hello, I have a class News story related to Manytoone with a class Secao. The Noticia class has an attribute of type Secao (where the @Manytoone relation occurs). I would like to know how to, in the news registration form, send the section to which it should be part.

Note: I already have the list of sections available in JSP and the user selects the section for the news that will register through a selection field. However I do not know how to pass the dried object as attribute of the news that will be registered. Someone can help me?

Thank you.

1 answer

0


<select name="secao.atributoDeSecaoQueSeraDefinido">
  <option value="politica">Política</option>
</select>

You can try this way, but as you should already have the registered section, I think taking the ready object of the form will not make the relationship. So you just take the value of the section that the guy chose, search for the object in this section and define in the news object.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.