Note that there are some explanatory texts on larger screens.

plurals
  1. POadd user entered data to database using jsf
    primarykey
    data
    text
    <p>As I'm new to JSF framework, wanted to know how to add the user entered data to the database. More clearly, i'm using jsf with jsp, my jsp contains some input fields and a submit button.How do i capture all the user entered data and send it as input paramters for the button, as my back end takes all these as input parameters and updates the table with a new record.</p> <p>Please look into my code and lety me know my mistake</p> <h2>Registration.jsp</h2> <pre><code>&lt;body&gt; &lt;f:view&gt; &lt;h:form&gt; &lt;h:panelGrid columns="2" rules="all" width="100%" style="background:#03547C;color:#FDD017"&gt; &lt;h:column&gt; &lt;h:outputText value="Stu No : "&gt;&lt;/h:outputText&gt; &lt;h:inputText value="#{RegBean.stuNo}"/&gt; &lt;/h:column&gt; &lt;h:column&gt; &lt;h:outputText value="Stu Name : "&gt;&lt;/h:outputText&gt; &lt;h:inputText value="#{RegBean.stuName}"/&gt; &lt;/h:column&gt; &lt;h:column&gt; &lt;h:outputText value="Standard : "&gt;&lt;/h:outputText&gt; &lt;h:inputText value="#{RegBean.standard}" /&gt; &lt;/h:column&gt; &lt;h:column&gt; &lt;h:outputText value="School : "&gt;&lt;/h:outputText&gt; &lt;h:inputText value="#{RegBean.school}" /&gt; &lt;/h:column&gt; &lt;/h:panelGrid&gt; &lt;h:panelGrid columns="2" rules="all" width="100%" style="background:#03547C;color:#FDD017"&gt; &lt;h:column&gt; &lt;h:form&gt; &lt;h:commandButton id="submitBtn" value="Submit" action="#{RegBean.submitDetails}"&gt; &lt;f:param name="sNo" value="#{RegBean.stuNo}" /&gt; &lt;f:param name="sName" value="#{RegBean.stuName}" /&gt; &lt;f:param name="std" value="#{RegBean.standard}" /&gt; &lt;f:param name="schl" value="#{RegBean.school}" /&gt; &lt;/h:commandButton&gt; &lt;/h:form&gt; &lt;/h:column&gt; &lt;/h:panelGrid&gt; &lt;/h:form&gt; &lt;/f:view&gt; &lt;/body&gt; </code></pre> <p></p> <h2>Registration Bean</h2> <pre><code>public class VendorRegBean { private String stuNo; private String stuName; private String standard; private String school; // getters and setters public void submitDetails() { Map requestMap = context.getExternalContext().getRequestParameterMap(); String stNo = (String) requestMap.get("sNo"); String stName = (String) requestMap.get("sName"); String stndrd = (String) requestMap.get("std"); String scl = (String) requestMap.get("schl"); vReg.stuRegistration(stNo ,stName ,stndrd ,scl ); } </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload