我在一個名爲information.jsp的jsp文件中創建了一個textarea,當用戶點擊提交時,它試圖讓它將輸入從它存儲到數據庫中。我做了information.hbm.xml文件如下圖所示:如何使用休眠功能將textarea輸入存儲到數據庫中?
information.jsp:
<textarea id = "desc" rows="5" cols="115" onkeypress="textCounter(this,20);"><c:out value="${informationView.storedDescription}"/></textarea>
information.hbm.xml
<hibernate-mapping>
<class name="Information" table="INFO_USER">
<id name="id" type="long" column="INFO_ID">
<generator class="native">
<param name="sequence">ID_SEQ</param>
</generator>
</id>
<property name="description" column="DESC"/>
</class>
</hibernate-mapping>
我然後做了類Information
與getter和setter描述來存儲和檢索數據庫中的信息。我只是無法弄清楚如何從提交事件的textarea獲取輸入描述...
從我一直在閱讀我認爲我必須使InformationAction
實際上讓它保存,當有人點擊提交但再次不確定。我是Hibernate的新手,在保存輸入到數據庫的過程中出錯的地方有點遺憾,如果有人重新打開頁面,它會自動檢索它以加載到textarea中。
我只是無法弄清楚我將如何將輸入從textarea傳遞到數據庫。 任何幫助將是偉大的,因爲我一直在這個工作了很長時間,無法弄清楚。如果您需要更多信息,請告知我,謝謝。