i have 2 table:
message(id, name, content, channel_number) // channel_number is foreign key
channel(number, name) // number is primary key
i use hibernate to map 2 table
java class
public class Message {
private Integer id;
private String name;
private String content;
private Channel channel;
}
public class Channel {
private Integer number;
private String name;
}
hibernate config
<class name="Message" table="message">
<id name="id" column="id">
<generator class="native" />
</id>
<property name="name" column="name" />
<property name="content" column="content" />
<many-to-one name="channel" column="channel_number" not-null="true" />
</class>
<class name="Channel" table="channel">
<id name="number" />
<property name="name" />
</class>
in spring, i have form to create/edit message. i have a select box to choose a channel. So, i load all channels in controller & show in view
<form:form commandName="message" method="post" action="messageForm.htm">
...
<form:select path="channel" items="${channelList}" itemValue="number" itemLabel="name"/>
</form:form>
when i press submit, nothing happen, it's still in jsp page & no redirect to onSubmit method (everything work well before i add this select)