I have a .jsp file with the following form:
<s:form action="addnews" method="post" cssClass="form" enctype="multipart/form-data">
<s:file name="upload" required="required" />
<s:textfield name="title" cssClass="form-control" placeholder="Başlık" required="required" />
<s:select name="language" list="{'TR', 'RO', 'RO'}" cssClass="form-control" />
<s:textarea name="text" />
<s:submit cssClass="btn btn-default" style="margin-top: 20px;" value="Gonder" />
</s:form>
This is my struts.xml:
<action name="newsform" class="panelAction" method="loadForm">
<result name="success">/pages/turkish/authenticated/newsform.jsp</result>
</action>
<action name="addnews" class="newsAction" method="createNews">
<result name="success">/pages/turkish/authenticated/success.jsp</result>
<result name="input">/pages/turkish/authenticated/newsform.jsp</result>
</action>
The newsform action is used to display a JSP with a form. Then, addnews action collects the input data and adds a news.
My problem is that the newsform action calls the addnews action without waiting the user to press the submit button, consequently, a null pointer is thrown. How can I tell struts to wait for the user input, then submit my form?
Thank you
No comments:
Post a Comment