Home Answers Viewqa JSF-Questions how to capture jsf form data

 
 


srikala
how to capture jsf form data
1 Answer(s)      4 years and 7 months ago
Posted in : Java Server Faces Questions

View Answers

October 17, 2008 at 5:23 PM


Hi friend,

"user.jsp"

<%@ page contentType="text/html"%>
<%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h"%>

<f:view>
<html>
<head><title>JSF Simple Login Example</title></head>

<body>
<h:form>
<table>
<tr>
<td><h:outputText value="Enter Login ID: " /></td>
<td><h:inputText id="loginname" value="#{SimpleUser.loginname}" /></td>
</tr>
<tr>
<td><h:outputText value="Enter Password: " /></td>
<td><h:inputSecret id="password" value="#{SimpleUser.password}" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><h:commandButton value="Login" action="#{SimpleUser.addUser}" /></td>
</tr>
</table>
</h:form>
</body>
</html>
</f:view>

"faces-config.xml"


<managed-bean>
<managed-bean-name>SimpleUser</managed-bean-name>
<managed-bean-class>roseindia.SimpleUser</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>


<navigation-rule>
<from-view-id>/pages/user.jsp</from-view-id>
<navigation-case>
<from-action>#{SimpleUser.addUser}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>/pages/resultforsuccess.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-action>#{SimpleUser.addUser}</from-action>
<from-outcome>fail</from-outcome>
<to-view-id>/pages/resultforfail.jsp</to-view-id>
</navigation-case>
</navigation-rule>


"SimpleUser.java"


package roseindia;
import java.sql.*;

public class SimpleUser{
String loginname;
String password;
Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";;
String dbName = "user_register";
String driver = "com.mysql.jdbc.Driver";
String userName = "root";
String db_password = "root";

public SimpleUser(){}

public String getLoginname(){
return loginname;
}

public void setLoginname(String loginname){
this.loginname = loginname;
}

public String getPassword(){
return password;
}

public void setPassword(String password){
this.password = password;
}

String query = "" ;
public String addUser(){

Statement stmt;
try {
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url+dbName,userName,db_password);
System.out.println("Connected to the database");

query = "insert into userregister set username='"+loginname+"', password='"+password+"'";

stmt = conn.createStatement();

int i = stmt.executeUpdate(query);
if(i>0)
{
return "success";
}
conn.close();
System.out.println("Disconnected from database");
} catch (Exception e) {
e.printStackTrace();
}
return "fail";
}
}

For more information,Tutorials and Examples on JSF visit to :

http://www.roseindia.net/jsf/

Thanks









Related Pages:
how to capture jsf form data - Java Server Faces Questions
how to capture jsf form data  hi , i have a jsf page with username ,password and submitt button,if i submitt the data then it has to store in the database this is the task i have to do plese tell me the procedure how to do
capture
capture  How can i capture values or text selected in drop down menu or in combo box or in any input forms and print it on the same page ?? also the selected value i want to store it in data base. how can i do that?? plzzzz
Screen Capture
Screen Capture  How to capture the screen using jsps and servlets
How to capture screenshot in url?
How to capture screenshot in url?  Hi, How to capture screenshot and it will store the capture image in url like this http://localhost/xxx/yyy/ it wil not sore C:\ or D:\ it should store like this http://localhost/xxx/yyy
Screen Capture
Screen Capture  Hi deepak, I am trying to take a screen shot using java script Activex object. But Iam getting Automation server cant create object exception .how can i solve
How create csv format in jsf ?
How create csv format in jsf ?  Dear Friends , Good morning to all of you? I have a problem to create .CSV format in jsf. Actully I have successfully created .PDF files of my jasper report form jrxml in jsf
JSF Forms - Developing form based application
JSF Forms - Developing form based application   ... In this tutorial we will show you how to develop UI forms using JSF 1.2. ... Now we will create a bean that will hold the form data (user name
JSF Form Validation
about JSF. In this section on "JSF Form Validation" you will learn how to validate the JSF Form using tag libraries provided along with JSF 1.2...JSF Form Validation         
Java Server Faces (JSF)
the JSF form validation framework.  To explore how to make your... To understand the fundamentals of the JSF framework and how it can be used... in  configuring JSF. To discover how JSF integrates with JSP
HTML Form data into .CSV?
HTML Form data into .CSV?  how to store data from html form to csvfile in java
php web page capture
php web page capture  How to capture the history of a web page using PHP
How to upload image to server in j2me by multipart/form-data?
How to upload image to server in j2me by multipart/form-data?  Hi, I need upload data to java server from j2me 1.Two text messages and 3 capture... in multi part form data. 3.As write code to upload text and image.As it is working
How can we save a data list in jsf?
How can we save a data list in jsf?  I have a code in jsf that fires a query in Data Base each time it is called, i have added a validation check to fire query only if list is not-empty but the list gets empty each time
JSF Examples
will read about how to create form in your web application.   JSF Input Text... will find the examples like, how to get JSF, how to install JSF, how to create simple... the versions of JSF, and their releases in detail.   How JSF Fits For Web
JSF Books
, we discuss how form data is converted to Java objects and how... in the JSF framework, this chapter and the next- Data Tables-provide... the purchase. To get an idea of how JSF simplifies development
Data Capture from resume - JSP-Servlet
Data Capture from resume  Hi Sir, In My Application, when i Upload a resume the relevant columns like name,phone,email,skills etc need to be captured automatically and must be stored into the database. Please solve
how to post data in mysql php form
how to post data in mysql php form  how to post data in mysql php form
url capture in javaScript
url capture in javaScript  Hi All, I m creating a bookmark to capture the url of the site and the user's input in the bookmark,in javaScript.this...; <body> <form method="GET" action='Controller' name="showall"> <
validating a form before data is entered.
validating a form before data is entered.  How can I avoid validating a form before data is entered
JSF form tag
JSF form tag      This tag renders html form element which contains the data that is submitted...;title>jsf h:form example</title></head>   <body>
How to capture video and then how to store it in mobile memory
How to capture video and then how to store it in mobile memory  Hello there, I'm developing a mobile application where i'm capturing video from... but they are not working properly some of them capture video but doesn't allow me
form validation
form validation  how the form validation is done in jsf form using javaScript
JSF Training
? Advantages of JSF (vs. Standard MVC) Advantages of JSF (vs. Struts) JSF Features How... JSF Training     JSF... on the client. JSF technology simplifies the programming and offers lots of reusable
How to capture output from console into textarea in java?
How to capture output from console into textarea in java?  Hi, I would like to know how can we display the result of a program in java into a textarea instead of displaying it on console. Thanks
How to capture picture from webcam using java
How to capture picture from webcam using java  i want catch the image from web-cam using jsp, If anyone knows please answer me
JSF - Java Server Faces Tutorials
will learn how to validate the JSF Form using tag libraries... how to implement all theoretical concepts of JSF in developing...; How JSF Fits For Web Applications? JSF has many  advantages
JSF Tags
JSF Tags      JSF application typically uses JSP pages to represent views. JSF provides useful.... JSF provides 43 tags in two standard JSF tag libraries: JSF Core
how to display database data in jsf page - Java Server Faces Questions
how to display database data in jsf page  Hi, i created tables in database,now i need to display the tables in jsf page.Means i have to get...://www.roseindia.net/jsf/dataTable.shtml 2.Do some changes in "TableBean.java" class
how to get the data from database&how to display the database data in jsf - Java Server Faces Questions
how to get the data from database&how to display the database data in jsf ... data in jsf. plese tell me the solution with example. Thanks in advance. ... and to display the data from database in jsf visit to : http://www.roseindia.net/jsf
jsf
jsf  two datatables displaying in the tab but we are using same file.jspx in two different tabs how to solve this problem
JSF Renderers
data to the web server as a ?POST? request?. POST? request contains form data and URL of the form. This form data is placed in hash table and can be accessed... to interpret the form data. This is called decoding. Html output Tag handler asks each
JSF Introduction - An Introduction to JSF Technology
the data from database and then show on the form for editing...JSF Introduction - An Introduction to JSF Technology...; Java Server Faces or JSF for short is another new exciting technology
About JSF Framework. - Framework
the components. * It automatically saves the form data and repopulates the form when it is displayed at client side. * JSF encapsulates...About JSF Framework.  What is JSF? Why it is used?What is flow
JSF Form - Java Server Faces Questions
JSF Form  what is JSF form action
Display Data from Database in JSF Application
Display Data from Database in JSF Application  ... data from database in JSF application. Developing JSF  Application In this section, we are going to display data from database in JSF based web
How to display data in form using aryylist in struts - Java Beginners
How to display data in form using aryylist in struts  Hi, I want to display data using arraylist in struts pls help me Its urgent
Simple JSF Hello Application
like how to use JSF tags in JSP pages, how to configure the application... using JSF tag. Typically JSP page includes a form, which is submitted when...Simple JSF Hello Application    
How to use enctype="multipart/form-data" in DOJO - JSP-Servlet
How to use enctype="multipart/form-data" in DOJO  Hi All, I am... form method = "post" & enctype="multipart/form-data". In same page I am using... for enctype="multipart/form-data". Then I delete that tag & then try to upload
how to make drop down list in JSF & fetch data Item from database
how to make drop down list in JSF & fetch data Item from database  how to make drop down list in JSF & fetch data Item from database
Multipage form
Multipage form  I have a multipage form in php with 2 pages wnhen i submit the form data from both the pages should go in database how should i pass teh data from 1st page to 2nd page and then put the entire form data in mysql
how to get a values from a multipart/form-data - JSP-Servlet
how to get a values from a multipart/form-data  Dear sir , I... submitForm(f){ var form = document.createElement("form"); with(form) { method = "post"; action = "newEntryDetails2.jsp"; name = "form"; id = "form
Capture browser file download event - JSP-Servlet
Capture browser file download event  Hi, I appreciate your help and thaanks for that.But my question was when filedownload dialog box comes in browser,how we can come to know that user has clicked on Open,save or cancel button
displaying data from ms excel in form.
displaying data from ms excel in form.  Hi all, I have a requirement as mentioned below: Requirement: I have stored some data in the ms excel... (for example). I need to display these data in a form. along with the actual picture
How to save form data to a csv file using jquery or ajax
How to save form data to a csv file using jquery or ajax  Please let me know more about how to do this or please suggest me any sites to learn...=data.responseText; Now the problem is ,i should write form data to a csv file using ajax
JSF Life Cycle
JSF Life Cycle In this section we will discuss about life cycle of JSF. This section will describe you JSF life cycle. Life cycle of JSF specifies the phases of execution of JSF based applications. A JSF application follows a certain
How to insert data into databse by JSP form registration page in netbeans
How to insert data into databse by JSP form registration page in netbeans  .... & how to connect tht form to my databse , so it can store data?   1...; password, & after submitting this form it automatically stores data
how to save html form data into .csv file using only jsp.
how to save html form data into .csv file using only jsp.  Dear all, I am developing a website only using jsp and html. i need to save the form data... inserted into the excel file. 1)Create form.jsp <html> <body> <form
How do i validate form using javascript and send data to database?
How do i validate form using javascript and send data to database?  I need a "JOIN US" form that can validate using javascript and be able to connect with and post data into a database. The details to be validated and posted
JSF EXAMPLES
the examples provided by SUN, in the JSF package. The JSF1.1 can be downloaded form..., update or delete data in a row visually without writing SQL code.The JSF...JSF EXAMPLES EXPLORED (Part-1)  by Farihah Noushene, B.E. (published
JSF Tutorial For Beginners
tags, JSF listeners and events, JSF integration, validation in JSF, how..., setProperyActionListener, phaseListener, event. Validation In JSF In JSF to validate data...JSF Tutorial For Beginners In this section you will learn about the JSF

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.