Mysql update form  a form in jsp page

<?xml version="1.0" encoding ="iso-8859-1"?>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%-- set up database source --%>
<c:if test="${empty sessionScope.mc07kpkDataSource}">
<sql:setDataSource
var="mc07kpkdbDataSource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/mc07kpkdb"
scope="session"
user="mc07kpk_web"
password="beGin+35"
/>
</c:if>
<%-- insert details to trader table --%>
<c:catch var="insertDetails">
<sql:update dataSource="${sessionscope.mc07kpkDataSource}">
INSERT into trader (dbTraderPNumber,dbTraderPwd,dbTraderName,dbTraderEmail,dbTraderProgramme,dbTraderDOB,dbTraderPhoneNum,dbTraderDepartment)
VALUES (?,?,?,?,?,?,?,?)
<sql:param value="${param.txtname}"/>
<sql:param value="${param.txtdepartment}"/>
<sql:param value="${param.txtprogramme}"/>
<sql:param value="${param.txtphonenum}"/>
<sql:dateParam value="${txtdob}" type="date" />
<sql:param value="${param.txtuserid}"/>
<sql:param value="${param.txtpassword}"/>
</sql:update>
</c:catch>
<c:if test="${!empty insertFailure}">
<p><b> User Registration Failed</b></p>
</c:if>
<head>
<title>Registeres USers Login Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<body>
<form action="" method="post" name="frmLogin" >
<table border="0" align="right" cellpadding="2" cellspacing="0">
<tr>
          <td width="64">Username:</td>
<td width="60"><input name="txtLUserId" type="text" size="10"></td>
</tr>
     <tr>
<td width="64">Password:</td>
     <td width="60"><input name="txtLPassword" type="password" size="10"></td>
</tr>
     <tr>
     <td colspan="2"align="center">
     <input name="btnLogin" type="submit" onclick="Traderhomepage.jsp">
     </td>
     </tr>
</table>
</form>
<p> </p>
<p> </p>
<table width="1049" cellpadding="5" align="center">
<tr>
<td width="2378"><div align="center">
<h2 align="center"> User Registration</h2>
<p>Home | Register | Books For Sale | Buy Or Sell</p>
</div></td>
</tr>
</table>
<p align="center"> </p>
<p>This website is only open to members of the De MontFort University.
You will need a current @learner.dmu.ac.uk e-mail address in order to register.</p>
<p> If you've already registered for one site you do not need to register again </p>
<form action="userregistration.jsp" method="get" name="userfrm" id="form1">
<table width="726" height="285" border="0" align="left" cellpadding="2" cellspacing="0">
<tr>
<td width="157" align="right" >Name:</td>
<td width="561" ><input name="txtname" type="text" id="txtname" />
</td>
</tr>
<tr>
<td width="157" align="right" >Department</td>
<td align="left" >
<select name="txtdepartment" id="txtdepartment" >
<option></option>
<option>Faculty of Art and Design</option>
<option>Faculty of Business and Law</option>
<option>Faculty of Computing Sciences and Engineering</option>
<option>Faculty of Health and Life Sciences</option>
<option>Faculty of Humanities</option>
</select>
</td>
</tr>
<tr>
<td align="right" >Programme</td>
<td ><input type="text" name="txtprogramme" />
(eg: BIS,SE) </td>
</tr>
<tr>
<td align="right" >Telephone Number: </td>
<td ><input name="txtphonenum" type="text" /></td>
</tr>
<tr>
<td align="right" >Date Of Birth: </td>
<td ><input name="txtday" type="text" size="15">(of format YYYY-MM-DD)</td></td>
</tr>
<tr>
<td align="right" >Username</td>
<td align="left" >
<input name="txtuserid" type="text" size="15"/>
(eg. p07269027 from [email protected])</td>
</tr>
<tr>
<td align="right" >Password</td>
<td align="left" >
<input name="txtpassword" type="password" size="15" />
</td>
</tr>
<tr>
<td align="right" >Confirm Password </td>
<td align="left" >
<input name="txtpasswordconf" type="password" size="15" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input name="register" type="submit" value="register" />
</td>
</tr>
</table>
</form>
</body>
</html>
please let me know the problem in updating data from the form to my database.

userregistration.jsp ( view)
<c:url value="/cw/router/userregistration" var="UregPgeURL" scope="page"/>
<form action="${UregPgeURL}" method="get" >
<div>
<table width="726" height="285" border="0" align="left" cellpadding="2" cellspacing="0">
<tr>
<td width="157" align="right" >Name:</td>
<td width="561" > <input name="txtname" type="text" value="${param.txtname}"/> </td>
</tr>
<c:if test="${!empty requestScope.reqInvalidUserName}">
<c:out value="${requestScope.reqInvalidUserName}"/>
</c:if>
<tr>
<td width="157" align="right" >Department</td>
<td align="left" >
<select name="txtdepartment" id="txtdepartment" value="${param.txtdepartment}" >
<option></option>
<option>Faculty of Art and Design</option>
<option>Faculty of Business and Law</option>
<option>Faculty of Computing Sciences and Engineering</option>
<option>Faculty of Health and Life Sciences</option>
<option>Faculty of Humanities</option>
</select>
</td>
</tr>
<tr>
<td align="right" >Programme</td>
<td ><input type="text" name="txtprogramme" value="${param.txtprogramme}" />
(eg: BIS,SE) </td>
</tr>
<tr>
<td align="right" >Telephone Number: </td>
<td ><input name="txtphonenum" type="text" value="${param.txtphonenum}" /></td>
</tr>
<tr>
<td align="right" >Date Of Birth: </td>
<td ><input name="txtday" type="text" size="15" value="${param.txtdob}" >(of format YYYY-MM-DD)</td></tr>
<c:if test="${!empty requestScope.reqInvalidDOB}">
<c:out value="${requestScope.reqInvalidDOB}"/>
</c:if>
<tr>
<td align="right" >Username</td>
<td align="left" >
<input name="txtuserid" type="text" size="15" value="${param.txtuserid}" />
(eg. p07269027 from [email protected])</td>
<c:if test="${!empty requestScope.reqInvalidUserId}">
<c:out value="${requestScope.reqInvalidUserId}"/>
</c:if>
</tr>
<tr>
<td align="right" >Password</td>
<td align="left" >
<input name="txtpassword" type="password" size="15" value="${param.txtpassword}" />
</td></tr>
     <c:if test="${!empty requestScope.reqInvalidPassword}">
<c:out value="${requestScope.reqInvalidPassword}"/>
</c:if>
<tr>
<td align="right" >Confirm Password </td>
<td align="left" >
<input name="txtpasswordconf" type="password" size="15" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input name="frmsubmit" type="submit" value="Register User" />
<input type="reset" name="Reset" value="Reset" />
</td>
</tr>
</table>
     <c:if test="${!empty requestScope.reqQueryErrorMessage}">
<c:out value="${requestScope.reqQueryErrorMessage}"/>
</c:if>
     <c:if test="${!empty requestScope.reqInvalidUpdate}">
<c:out value="${requestScope.reqInvalidUpdate}"/>
</c:if>
proregistration.jsp(process page)
<?xml version="1.0" encoding ="UTF-8"?>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<c:if test="${empty param.frmsubmit}">
<c:set var="reqOutcome" scope="request" value=" " />
<jsp:forward page="/WEB-INF/jsp/cwjsps/userregistration.jsp"/> <%-- initial request --%>
</c:if>
<-- validate txtname --%>
<c:if test="${empty param.txtname }">
<c:set var=reqInvalidUserName" scope="request" value= "User Name Cannot Be Empty" />
</c:if>
<-- validate txtuserid --%>
<c:if test="${empty param.txtuserid }">
<c:set var=reqInvalidUserId" scope="request" value= "User ID Cannot Be Empty" />
</c:if>
<-- validate txtpassword--%>
<c:if test="${empty param.txtpassword }">
<c:set var=reqInvalidPassword" scope="request" value= "Password Cannot Be Empty" />
</c:if>
<-- validate txtdob --%>
<c:if test="${empty param.txtdob }">
<c:set var=reqInvalidDOB" scope="request" value= "Invalid Date Of Birth" />
</c:if>
<-- if userid invalid or username invalid --%>
<-- redisplay form with originl typed-in data and with errors marked --%>
<c:if test="${empty param.txtname or empty param.txtuserid }">
<c:set var=reqOutcome" scope="request" value= "failure" />
<jsp:forward page="/WEB-INF/jsp/cwjsps/userregistration.jsp"/> <%-- failure --%>
</c:if>
<%-- check for query errors --%>
<c:catch var="insertQueryError">
<sql:update
var="pgeRowCount"
scope="page" >
<%-- insert details to trader table --%>
<c:catch var="pgeQueryError">
<sql:update var="pgeRowCount" scope="page">
INSERT into trader (dbTraderName,dbTraderDepartment,dbTraderProgramme,dbTraderPhoneNum ,dbTraderDOB,dbTraderPNumber,dbTraderPwd)
VALUES (?,?,?,?,?,?,?,?)
<sql:param value="${param.txtname}"/>
<sql:param value="${param.txtdepartment}"/>
<sql:param value="${param.txtprogramme}"/>
<sql:param value="${param.txtphonenum}"/>
<sql:dateParam value="${txtdob}" type="date" />
<sql:param value="${param.txtuserid}"/>
<sql:param value="${param.txtpassword}"/>
</sql:update>
</c:catch>
<%-- check For query Error -- %>
<c: if test="${not empty pgeQueryError}">
<c:choose>
<%-- check For duplicate record --%>
<c:when test="${pgeQueryError.rootcause.errorCode == '1062'}">
<c:set var="reqQueryErrorMessage" scope="request" value="Duplicate Record" />
</c:when>
<c:otherwise>
<%-- database error --%>
<c:set var="reqQueryErrorMessage" scope="request" value="Database Error" />
</c:otherwise>
</c:choose>
<c:set var="reqOutcome" scope="request" value="failure" />
<jsp:forward page="/WEB-INF/jsp/cwjsps/userregistration.jsp"/> <%-- failure --%>
</c:if>
<%-- check For no rows returned --%>
<c:if test="${pgeRowCount !=1}">
<c:set var="reqInvalidUpdate" scope="request" value="*** rowCount not = 1"/>
<c:set var="reqOutcome" scope="request" value="failure" />
<jsp:forward page="/WEB-INF/jsp/cwjsps/userregistration.jsp"/> <%-- failure --%>
</c:if>
<%-- Otherwise --%>
<%-- Outcome is success --%>
<c:set var="reqOutcome" scope="request" value="success" />
<jsp:forward page="/WEB-INF/jsp/cwjsps/login.jsp"/> <%-- success --%>
</c:if>
Router.jsp (mapping URL)
<%-- setup session if one does not exist --%>
<%@ page session="true" %>
<%-- set up debug variable --%>
<c:set var="sessDebug" scope="session" value="false" />
<%-- get pathinfo information from the request --%>
<%-- this defines which use case has been requested --%>
<c:set var="pgePathInfo" scope="page" value="${pageContext.request.pathInfo}" />
<%-- uc02 : Login --%>
<c:if test="${pageScope.pgePathInfo =='/home'}" >
<jsp:forward page="/WEB-INF/jsp/cwjsps/home.jsp"/>
</c:if>
<c:if test="${pageScope.pgePathInfo =='/login'}" >
<jsp:forward page="/WEB-INF/jsp/cwjsps/login.jsp"/>
</c:if>
<%-- uc01 : View Details Of Books For Sale --%>
<c:if test="${pageScope.pgePathInfo =='/viewbooksforsale'}" >
<jsp:forward page="/WEB-INF/jsp/cwjsps/viewbooksforsale.jsp"/>
</c:if>
<%-- uc01 : User registration--%>
<c:if test="${pageScope.pgePathInfo =='/userregistration'}" >
<jsp:forward page="/WEB-INF/jsp/cwjsps/userregistration.jsp"/>
</c:if>
<%-- uc01 : debug --%>
<c:if test="${pageScope.pgePathInfo =='/debug'}" >
<jsp:forward page="/WEB-INF/jsp/cwjsps/debug.jsp"/>
</c:if>
<%-- otherwise --%>
<jsp:forward page="/WEB-INF/jsp/cwjsps/home.jsp"/>
debug.jsp
<%-- \WEB-INF\jsp\cw\debug.jsp --%>
<%-- debug include file --%>
<c:if test ="${sessionScope.sessDebug == 'true'}">
<table border="1">
<c:forEach var="item" items="${cookie}">
<tr>
<td>inbound cookies</td>
<td>${item.key}</td>
<td>${item.value.value}</td> <%--note the .value.value--%>
</tr>
</c:forEach>
<c:forEach var="item" items="${param}">
<tr>
<td>inbound parameter</td>
<td>${item.key}</td>
<td>${item.value}</td> <%--note the .value--%>
</tr>
</c:forEach>
<c:forEach var="item" items="${requestScope}">
<tr>
<td>request scope object</td>
<td>${item.key}</td>
<td>${item.value.value}</td>
</tr>
</c:forEach>
<c:forEach var="item" items="${sessionScope}">
<tr>
<td>session scope object</td>
<td>${item.key}</td>
<td>${item.value.value}</td>
</tr>
</c:forEach>
</table>
</c:if>
1. cannot update mysql table with values from user registration form.
2. if i turn the sessionScope = "true" in router.jsp i get error while accessing userregistration.jsp

Similar Messages

  • Forms integration into a JSP page

    There is a great White Paper on the OTN's home page about how to integrate a Forms application within a JSP page ;o)
    <p>Integrating Oracle Forms into Oracle ADF Faces</p>
    Francois

    thx for the link. Good work

  • I want to post the values of the form in the same Jsp Page

    I want to post the values of the form in the same Jsp page.

    Was that a question? Or are you just informing the world of your grand intentions?
    But yeah, all you need to do is direct your action to the same page you're in. So, if this is your foo.jsp, it'd be something like...
    <%
    if(request.getParameter("bar") != null) out.println("Hello");
    %>
    <form method="post" action="foo.jsp">
       <input type="text" name="bar" value="baz">
       <input type="submit">
    </form>When you submitted your form, it would post the value to the same JSP page as you're already in, and print out Hello to the screen. "Hello" would not print out on the first visit, as the request would obviously not contain the parameter "bar" yet.

  • How update the info on same Jsp page

    i have a Jsp page.on left side of this page having menu bar. in this menu bar having links of some colleges.
    i want when i click on link of first college name, same page should be updaed with updated menu bar where i can show the information of the concerning college.
    please focus on this.

    I have two Jsp pages named bestschool.jsp and schoolnames.jsp.
    I am calling schoolnames.jsp from bestschool.jsp.
    I want when I click the link on INDUS School. It can show all concerning link of INDUS School links like profile, result, facility etc. in the same place instead of other naming school links.
    my requiremet main is i want to update the information on same Jsp page.
    How can I implement this with in Servlets/Jsp.
    Please review below JSP’s files
    schoolnames.jsp
    <table width="200" border="0" align="center" cellpadding="5">
    <tr>
    <td height="100" bgcolor="#476bc0">
    <div align="center" class="boldhead"><font size="+1">
    School list</font></div>
    </td>
    <tr>
    <td height="30" bgcolor="#5577C6">
    <a href="" class="smalltext">INDUS School</a></td>
    </tr>
    <tr>
    <td height="30" bgcolor="#728DCF">
    <a href="" class="smalltext">Vaise School</a>
    </td>
    </tr>
    <tr>
    <td height="30" bgcolor="#728DCF">
    <a href="" class="smalltext">D.G.V School</a></td>
    </tr>
    <tr>
    <td height="30" bgcolor="#728DCF">
    <a href="" class="smalltext">D.P.S School </a></td>
    </tr>bestschool.jsp
    <html>
    <head>
    <title>Best school</title>
    <link href="mystyle.css" rel"stylesheet" type="text/css">
    </head>
    <body>
    <div align="center"><font size="+2">
    Best Schools in Rohtak</font>
    </div>
    <table width="700" height="500" border="0" align="left"
    cellspacing="0">
    <td width="200" rowspan="2" valign="top">
    <%@ include file="schoolnames.jsp" %>
    </td>
    <td height="328" bgcolor="#476BC0" valign="top">
    <p> </p><p> </p><p> </p>
    </html>please suggest.

  • How to submit two forms once  in one jsp page?

    hello all,
    My jsp page includes two forms: one form's action is a File Upload servlet, which process file uploading; another is a general servlet to collect user inputs, such as user name, age, etc.
    Because the file upload servlet is a legacy component, and it was used in many applications. we could not meger it into our business components.
    the system requires the file upload and information collection are submitted once. so we have to submit two forms in one 'Submit' action, at the same time, the information collection servlet need get the information from file upload servlet, such as the uploaded file's url.
    I have tried two methods, but all failed
    1. Upload form has no a 'Submit' button, when user click the 'submit' button of the information collection form, we use a javascript to submit upload form first, then submit information collection form. Failed at: the second submit dose wait for upload finishing, then the second submit interrupt the upload
    2. the javascript only submit upload form, and set HTML body's onUnload event to another javascript that submit information collection form. this time, the file upload sucess, and information collection form sucess at most time. But fail when user click the 'refresh' or 'back' or any navigator buttons of the browser. these action will trigger the page 'unload' event too, but the submit if invalid!
    Please tell me how to.

    chain the both requests!
    - build one mutlitpart request and send it to a servlet that can handle that multipart request (think of using oreilly MultiPartParser).
    - check the input (all requiered fields and files there)
    - if yes store the user fields and create a socket connection from your servlet to the legacy file upload servlet and post the file this way.
    - like this you have full control over the users input and can make sure the file and the fields are just save if all requiered elements are availble.

  • Two Identical forms on the same JSP page.???

    Hi want to have two identical submit forms on the same form but for some reason a get a javascript error when i add the second form to the JSP page... can you help me...

    I assume you meant "two identical submit buttons", instead of "two identical submit forms". Seeing your description of the problem, I believe you can reproduce it with a pure .html page, that is, a page containing not JSP code. So it is not a problem in JSP domain proper.
    I was going to direct you to the Technologies>>Internet>>Dynamic Services forum at
    http://forums.oracle.com/forums/thread.jsp?forum=95
    Then I found you have posted the same question as thread 298169 there.

  • How to open a JSP page from a form ??? plz help

    hi ..
    i want to know how to open a jsp page from a oracle apps form using a button .
    the requirement is that whenever we click on the button created on the form, it opens a jsp page.
    plz help me ..its urgent !! :-(

    In portlet project, to navigate between pages, you should not use the URL property to link to a page. Instead, portlets use navigation via action handling. You use the Page Navigation editor to set up links to pages; that is, the navigation editor sets the action property.
    Here is an example to hyperlink ans button to open a new page:
    # From within the IDE, create a new portlet project. This action creates the project and one page, PortletPage1.jsp.
    # Create a second portlet page, called PortletPage2.jsp, for the project.
    # Drop a Hyperlink component onto the first portlet page, PortletPage1. (You can drop the Hyperlink on the page in the Design window or on the PortletPage1 node in the Outline window.) Change the Hyperlink's text property to Next Page.
    # Drop a Button component (found in the Basic section of the Palette) onto the second portlet page, PortletPage2.
    # Open the Page Navigation Editor. It displays the two pages (PortletPage1.jsp and PortletPage2.jsp) of the application.
    # Click the PortletPage1.jsp icon in the Navigation window to expand it, and then drag a connector from hyperlink1 to PortletPage2.jsp. Change the name of the connector from case1 to Page2.
    # Click the PortletPage2.jsp icon in the Navigation window to expand it, and then drag a connector from button1 to PortletPage1.jsp. Change the name of the connector from case1 to Page1.
    # Run and deploy the portlet. The browser displays PortletPage1 and you should see the Next Page hyperlink. When you click the Next Page hyperlink, the Apache Pluto Portal server displays PortletPage2. Click the Page2 button to return to PortletPage1.
    Sherry
    Creator Team

  • Forwarding JSP page through requestdispatcher problem in submiting form

    Hello everyone,
    I am very much new to servlet.
    My problem is somewhat this....
    when i am forwarding one JSP page by requestdispather , there is no problem.But after that when i am trying to submit one html form written inside the jsp page , the request is not submiting the jsp page rather it resides in the servlet.
    The code in servlet is
    RequestDispatcher rd =getServletContext().getRequestDispatcher("/applyConfirm.jsp");
    rd.forward(request,response);
    Now in (applyConfirm.jsp )jsp page one button is there , so when i will click that button the page has to be submitted.But its not submitting rather the request resides in the servlet.
    Dose someone will have any idea.
    Thanks in advance

    First check what sort of button you are using. It should be of "submit" type.
    Check the URL to witch URL it is submitting i.e. Action property in <FORM> tag.
    Make sure for the URLs in the client i.e HTML ex: href, action, and so on use the thumb rule of prefixing "<%=request.getContextPath()%>/" in your JSP or in servlet add it in the java code.
    This should solve the relative URL reference problem.
    Hope this helps.
    Cheers.

  • How to call the form bean value on jsp withthe help of jstl tag

    hi
    all friends
    i am working in struts & i use jstl tag in jsp. i have one problem rise is how to call the form bean value in jsp page by using jstl tag.
    i now how to retrive the value through jsp:logic
    eg. <logic:empty name="userListForm" property="users">
    NO USER FOUND
    </logic:empty>
    see * userListForm mean formbaen name.
    * users means collection object.
    so how can i write above e.g in jstl

    You use the jstl core:if or core:choose combined with the EL:
    <c:if test="${empty users.userListForm}">
    NO USERS FOUND
    </c:if>I suggest you lookup the jsp expression language (EL) using google, it's very powerful.

  • Run Oracle Form Application from a JSP File.

    I have a complete customized application made on Oracle Forms (10g) and I have .fmb and .fmx files, now problem which I am facing is I have to open the Oracle Form Application from my JSP page (which is used to login the user). My JSP page is just a simple page which I have placed it in path [C:\DevSuiteHome2\forms\j2ee\formsapp\formsweb] and I run it from browser as [http://localhost:port/forms/index.jsp].
    How can I start my application from this JSP page? Please your help would be highly appreciated. Thanks.

    Inside your JSP page put <OBJECT> tag with all parameters and tags to open Jinitiator or java applet..
    my example..
    <!-- Forms applet definition (start) -->
    <OBJECT classid="clsid:CAFECAFE-0013-0001-0022-ABCDEFABCDEF"
            codebase="/forms/jinitiator/jinit.exe#Version=1,3,1,22"
            WIDTH="1024"
            HEIGHT="768"
            HSPACE="0"
            VSPACE="0">
    <PARAM NAME="TYPE"       VALUE="application/x-jinit-applet;version=1.3.1.22">
    <PARAM NAME="CODEBASE"   VALUE="/forms/java">
    <PARAM NAME="CODE"       VALUE="oracle.forms.engine.Main" >
    <PARAM NAME="ARCHIVE"    VALUE="frmall_jinit.jar,images.jar,in2kartica.jar,paketi.jar,prenospolic.jar,imgbean.jar,moj9999.jar" >
    <PARAM NAME="serverURL" VALUE="/forms/lservlet?ifcfs=/forms/frmservlet?form=zav0030f.fmx&acceptLanguage=sl-SI">
    <PARAM NAME="networkRetries" VALUE="30">
    <PARAM NAME="serverArgs"
           VALUE="escapeParams=true module=zav0030f.fmx userid=  sso_userid=%20 sso_formsid=%25OID_FORMSID%25 sso_subDN= sso_usrDN= debug=no host= port= buffer_records=no debug_messages=no array=no obr=no query_only=no quiet=yes render=no record=names tracegroup= log= term=/oracle/forme/qmsrf65w.res" >
    <PARAM NAME="separateFrame" VALUE="true">
    <PARAM NAME="splashScreen"  VALUE="">
    <PARAM NAME="background"  VALUE="">
    <PARAM NAME="lookAndFeel"  VALUE="Oracle">
    <PARAM NAME="colorScheme"  VALUE="teal">
    <PARAM NAME="serverApp" VALUE="default">
    <PARAM NAME="logo" VALUE="">
    <PARAM NAME="imageBase" VALUE="DocumentBase">
    <PARAM NAME="formsMessageListener" VALUE="">
    <PARAM NAME="recordFileName" VALUE="">
    <PARAM NAME="EndUserMonitoringEnabled" VALUE="">
    <PARAM NAME="EndUserMonitoringURL" VALUE="">
    <PARAM NAME="heartbeat" VALUE="">
    <PARAM NAME="clientDPI" VALUE="123">
    <COMMENT>
    <EMBED SRC="" PLUGINSPAGE="/forms/jinitiator/us/jinit_download.htm"
            TYPE="application/x-jinit-applet;version=1.3.1.22"
            java_codebase="/forms/java"
            java_code="oracle.forms.engine.Main"
          java_archive="frmall_jinit.jar,images.jar,in2kartica.jar,paketi.jar,prenospolic.jar,imgbean.jar,moj9999.jar,Paketi.jar,in2kartica.jarpaketi.jar,moj9999.jarin2kartica.jarpaketi.jar"
            WIDTH="1024"
            HEIGHT="768"
            HSPACE="0"
            VSPACE="0"
         clientDPI="123"
            serverURL="/forms/lservlet?ifcfs=/forms/frmservlet?form=zav0030f.fmx&acceptLanguage=sl-SI"
            networkRetries="30"
            serverArgs="escapeParams=true module=zav0030f.fmx userid=  sso_userid=%20 sso_formsid=%25OID_FORMSID%25 sso_subDN= sso_usrDN= debug=no host= port= buffer_records=no debug_messages=no array=no obr=no query_only=no quiet=yes render=no record=names tracegroup= log= term=/oracle/forme/qmsrf65w.res"
            separateFrame="true"
            splashScreen=""
            background=""
            lookAndFeel="Oracle"
            colorScheme="teal"
            serverApp="default"
            logo=""
            imageBase="DocumentBase"
            formsMessageListener=""
            recordFileName=""
            EndUserMonitoringEnabled=""
            EndUserMonitoringURL=""
            heartBeat=""
    >
    <NOEMBED>
    </COMMENT>
    </NOEMBED></EMBED>
    </OBJECT>
    <!-- Forms applet definition (end) -->

  • Updating Data in Database using JSP

    Hi all,
    Can anyone please give me an idea that i have a JSP page that connects to the MS Access database. Now i have a query that shows all the data sorted by date for each individual user. Now if anyone wants to update from there meaning that there should be an update button.And if anyone press that then all the on the particular row will be shown in text boxes and then the user can modify the data. and press update to send the data to the database and show the correct one on that page again.
    I know it is a bit hazy. Noe point is i created the query and the update button. Now how can i create text boxes for a particular row if button pressed and also i want to show the dataon this page again dont want to go to another page and do the same thing again. This will enable user to update each row separately on the same page and after all these he can log out. Please help me.
    Another question how can i pass some data from an HTML form to the same JSP but in a different place meaning that if i direct the form to the same JSP like "form action=same.jsp" then it will start doing everything from the beginning of the page. But i want to go to a particular form of the same JSP page. Can anyone please help me.
    I will be very grateful
    Thanks.

    Can anyone please look at it. Very Urgent. Thanks

  • Need a fast answer... passing javascript variable to jsp page (how to use)

    This test application has 3 frames.
    I'm assigning a value "stuff" to a variable ("testfield1") in a javascript function ("getTest") that exists inside an html frame (testpage1.html)
    Then, I click on the "test submit" hypertext link to pass the value of "testfield1" to the JSP frame (testpage2.jsp) by invoking a function ("getData") in "testpage2".
    In function ("getData"), I am passing the variable "testfield1" as a parameter to the "getData" function in "testpage2".
    In "testpage2" - in the ("getData" function) I try to assign the value of the variable "testfield1" to another variable called "testfld1".
    Then, I try to extract the value of "testfld1" into a variable called "tstfld1" in a JSP scriptlet
    ....I.E. [ String tstfld1  = request.getParameter("testfld1");  ]
    But, the value is apparently not passed successfully, as tstfield1 appears to be "null".
    Can anyone explain what I'm doing incorrectly?
    The code for this test app is below...
    ********testpage0 - the parent frame*********
    <HTML>
    <HEAD>
    <TITLE>GlobalView Reports and Trending Menubar</TITLE>
    </HEAD>
    <FRAMESET FRAMEBORDER="0" ROWS="15%,85%">
    <FRAME SRC="testpage0.html" NAME="testhtmlparent">
    <FRAMESET FRAMEBORDER="0" COLS="23%,77%">
    <FRAME SRC="testpage1.html" NAME="testhtml">
    <FRAME SRC="testpage2.jsp" NAME="testjsp">
    </FRAMESET>
    </FRAMESET>
    </HTML>
    *******testpage1.html********
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <html>
         <head><title>testpage1</title>
         <link rel="stylesheet" type="text/css" href="./standard.css">
              <script LANGUAGE="JavaScript">
              parent.frames[2].location = "blank.html";
              function getTest(reportType)
                   testfield1 = "stuff";
                   alert("testpage1.html...testfield1=" + testfield1 + ", reportType=" + reportType);
                   parent.frames[2].location = "testpage2.jsp";
                   parent.frames[2].getData(testfield1);
                   return;
              </script>
         </head>
         <body bgcolor="#FFFFFF" text="#000000">
              <form name="reportRange">
                   <center>
                        <fieldset style="padding: 0.5em" name="customer_box">
                        <table cellpadding="0" cellspacing="0" border="0">
                             <tr class="drophead">
                                  <td valign="top" height="0" ><span class="drophead">
                                       test submit
                                  </td>
                             </tr>
                        </table>
                        </fieldset>
                   </center>
              </form>
         </body>
    </html>
    *******testpage2.jsp*********
    <%@ page language="java" import="java.io.*, java.util.*" errorPage="error.jsp" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <html>
         <head>
         <title>testpage2</title>
         <script language="JavaScript">
              function getData(testfield1)
                   alert("testpage2.jsp...testfield1=" + testfield1);
                   document.pageData.testfld1.value = testfield1;
                   document.pageData.submit();
         </script>
         </head>
         <body>
              <%
                   String error;
              %>
              <div id="HiddenForm">
                   <form name="pageData" method="post" action="testpage2.jsp" target="_self">
                   <input type="hidden" name="testfld1" value="0">
              </form>
              </div>
              <%
                   String tstfld1 = request.getParameter("testfld1");
              %>
              <P> testfld1 = <%= tstfld1 %> </P>
         </body>
    </html>

    parent.frames[2].getData(testfield1); is in testpage1.html
    so in the document.pageData.testfld1.value = testfield1; document = testpage1.html( not testpage2.html)
    modifying the getData to accept the document object, and refering this object to parent.frames[2].document may help you.
    good Luck ....

  • Passing jsf parameters to a jsp page

    how to access the parameters declared in jsf page from a jsp page.
    in the jsp page I need to access the paramaters something like request.getParameter("age");
    how to declare the same in the jsf page in h form.
    <h:form>
    <h:inputText value="" id = "age" />
    </h:form>
    and in the jsp page i should access this parameter like request.getParameter("age");
    how to accomplish this.
    Please help.

    Please don't doublepost. Continue here: http://forum.java.sun.com/thread.jspa?threadID=5252759

  • Cant display index.jsp page of application folder

    Hello experts,
    I am trying to do one simple struts application using Struts2 get the data and display it..
    I kept my folder that is Struts2Application in webbaps dir of tomcat..
    when I write the "http://localhost:8080/Struts2Application" it displays the same page i.e. home page of tomcat, it dosnt show the index.jsp
    and when I write the "http://localhost:8080/Struts2Application/index.jsp" then also displays the home page of tomcat..
    my web.xml is
    <?xml version="1.0" encoding="iso-8859-1"?>
    <web-app id="WebApps_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLoacation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <display-name>Struts 2 applicaion</display-name>
    <filter>
         <filter-name>struts2</filter-name>
         <filter-class>
              org.apache.struts2.dispatcher.FilterDispatcher
         </filter-class>
    </filter>
         <filter-mapping>
              <filter-name>struts2</filter-name>
              <url-pattern>/*</url-pattern>
         </filter-mapping>
         <welcome-file-list>
              <welcome-file>index.jsp</welcome-file>
         </welcome-file-list>
    </web-app>Please help me out.....

    Please check out following all files...
    index.jsp
    <%@ page contentType="text/html; charset=UTF-8"%>
    <%@ taglib prefix="s" uri="struts-tags" %>
    <html><head><title>Struts 2 Application</title>
              <link rel="stylesheet" href="mystyle.css" type="text/css" />
         </head>
         <body>
         <h1> Struts 2 Applicaton</h1>
         Enter Client Details :
              <s:form action="ClientAction" method="post">
                   <s:textfield label="Name" name="name"/>
                   <s:textfield label="Age" name="age"/>
                   <s:textfield label="Salary" name="salary"/>
                   <s:submit/>
              </s:form>
         </body>
    </html>client.jsp
    <%@ page contentType="text/html; charset=UTF-8" %>
    <%@ taglib prefix="s" uri="/struts-tags" %>
    <html>
         <head>
              <title>You submitted </title>
         </head>
         <body>
              Thank you, <b><s:property value="name"/></b>
              your salary is : <b><s:property value="salary"/> $</b>
         </body>
    </html>error.jsp
    <%@ page contentType="text/html; charset=UTF-8"%>
    <%@ taglib prefix="s" uri="struts-tags" %>
    <html>
         <head>
              <title>Struts 2 Application</title>
              <link rel="stylesheet" href="mystyle.css" type="text/css" />
         </head>
         <body>
         <h1> Error..! </h1>
         This error page is being shown because any of following reasons :
         <ul class="boldred">
         <li>Filed(s) left blank.</li>
         <li>Invalid Data Entered.(For examples: String in place of Integer.)</li>
         </ul>     
    </body>
    </html>struts.xml
    <?xml version="1.0" encoding="iso-8859-1"?>
    <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
    <struts>
         <include file="struts-default.xml"/>
         <package name="default" extends="struts-default">
              <action name="ClientAction" class="com.kogent.action.ClientAction">
                   <result name="success">/client.jsp</result>
                   <result name="error">/error.jsp</result>
                   <result name="input">/error.jsp</result>
              </action>
         </package>
    </struts>ClientAction.java
    // Java Document
    package com.kogent.action;
    import com.opensymphony.xwork2.*;
    import com.opensymphony.xwork2.ActionSupport;
    public class ClientAction extends ActionSupport
         String name;
         int age;
         int salary;
         public String getName()
              return name;
         public void setName(String name)
              this.name = name;
         public int getAge()
              return age;
         public void setAge(int age)
              this.age = age;
         public int getSalary()
              return salary;
         public void setSalary(int salary)
              this.salary = salary;
         public String execute() throws Exception
              if(getName().equals("") || getName()==null || getAge()==0 || getSalary()==0)
                   return ERROR;
              else
                   return SUCCESS;
    }And I kept all jar files in lib folder of WEB-INF

  • Struts where are values stored between jsp pages?

    Hi.I realize that this is forum is not specifically for struts but I thought someone might know the answer to my question.
    I have run the following code. The code contains two JSP’s that both get there values from the same ArrayList generated by the same actionform so contain the same data. Example.jsp is diplayed when the application is first run when submit is clicked newjsp.jsp is displayed.
    If a value in the fields of example.jsp is changed and submit is clicked the altered value is also displayed in newjsp.jsp. I am confused by this as after submit is clicked ExampleForm.java method reset is called which returns the variable values to their original value but the newly entered value is still displayed. Please tell me how this works
    Example.jsp
    <%@ page language="java"%>
    <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
    <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
    <%@ taglib uri="http://struts.apache.org/tags-nested" prefix="nested"%>
    <html>
        <head>
            <title>JSP for exampleForm form</title>
        </head>
        <body>
            <html:form action="/example">
                <h3>Use of nested:iteration tag</h3>
                <nested:nest property="department">
         DEP. ID: <nested:text property="id"/> <br />
         NAME: <nested:text property="name"/> <br /><br />
                    <nested:iterate property="customers">
                        <b>Customer info</b><br />
              CUST. ID: <nested:text property="id"/> <br />
              NAME: <nested:text property="name"/> <br />
                    </nested:iterate>
                </nested:nest>
                <br />
                <br />
                <html:submit/><html:cancel/>
            </html:form>
        </body>
    </html>
    Newjsp.jsp
    <%@ page language="java"%>
    <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
    <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
    <%@ taglib uri="http://struts.apache.org/tags-nested" prefix="nested"%>
    <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
    <html>
        <head>
            <title>JSP for exampleForm form</title>
        </head>
        <body>
            <html:form action="/example">
                <h3>Use of nested:iteration tag</h3>
                <nested:nest property="department">
                    <table>
                        <nested:iterate property="customers">
                            <tr><td>Customer info</td>
                                <td>CUST. ID: <nested:text property="id"/> </td>
                                <td>NAME: <nested:text property="name"/> </td>
                            </nested:iterate>
                        </tr>
                    </table>
                </nested:nest>
                <br />
                <br />
                <html:submit/><html:cancel/>
            </html:form>
        </body>
    </html>
    ExampleAction.jsp
    package de.laliluna.tutorial.nested.action;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import de.laliluna.tutorial.nested.form.ExampleForm;
    import de.laliluna.tutorial.nested.object.*;
    import java.util.*;
    public class ExampleAction extends org.apache.struts.action.Action {
        /* forward name="success" path="" */
        private static final String SUCCESS = "success";
        @Override
        public ActionForward execute(ActionMapping mapping, ActionForm form,
                HttpServletRequest request, HttpServletResponse response)
                throws Exception {
            ExampleForm formBean = (ExampleForm) form;
            Department depart = formBean.getDepartment();
            ArrayList dep = (ArrayList) depart.getCustomers();
            Customer cust0 = (Customer) dep.get(0);
            System.out.println(">>>>>>>>>>>>>> customer.getName() = " + cust0.getName());
            System.out.println(">>>>>>>>>>>>>> customer.getId() = " + cust0.getId());
            Customer cust1 = (Customer) dep.get(1);
            System.out.println(">>>>>>>>>>>>>> customer.getName() = " + cust1.getName());
            System.out.println(">>>>>>>>>>>>>> customer.getId() = " + cust1.getId());
            Customer cust2 = (Customer) dep.get(2);
            System.out.println(">>>>>>>>>>>>>> customer.getName() = " + cust2.getName());
            System.out.println(">>>>>>>>>>>>>> customer.getId() = " + cust2.getId());
            return mapping.findForward("example");
    ExampleForm.jsp
    package de.laliluna.tutorial.nested.form;
    import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.action.ActionMessage;
    import de.laliluna.tutorial.nested.object.*;
    import java.util.ArrayList;
    import java.util.Collection;
    public class ExampleForm extends org.apache.struts.action.ActionForm {
        Department department;
        public Department getDepartment() {
            return department;
        public void setDepartment(Department department) {
            this.department = department;
        public void reset(ActionMapping mapping,
                HttpServletRequest request) {
            System.out.println("Entered action bean reset");
            Collection customers = new ArrayList();
            customers.add(new Customer(1, "Maria"));
            customers.add(new Customer(2, "Klaus"));
            customers.add(new Customer(3, "Peter"));
            department = new Department(1, "Department A", customers);
    Customer.java
    package de.laliluna.tutorial.nested.object;
    public class Customer {
        private int id;
        private String name;
        public Customer() {
        public Customer(int id, String name) {
            this.id = id;
            this.name = name;
        public int getId() {
            return id;
        public void setId(int id) {
            this.id = id;
        public String getName() {
            return name;
        public void setName(String name) {
            this.name = name;
    Department.java
    package de.laliluna.tutorial.nested.object;
    import java.util.Collection;
    public class Department {
        private int id;
        private String name;
        private Collection customers;
        public Department() {
        public Department(int id, String name, Collection customers) {
            this.id = id;
            this.name = name;
            this.customers = customers;
        public Collection getCustomers() {
            return customers;
        public void setCustomers(Collection customers) {
            this.customers = customers;
        public int getId() {
            return id;
        public void setId(int id) {
            this.id = id;
        public String getName() {
            return name;
        public void setName(String name) {
            this.name = name;
    }

    Thanks for responding.
    I set the debugger as you suggested and found that method reset is being called.
    I did not write the whole of this program I was just playing around with and expanding a struts example I found on line.
    http://www.laliluna.de/articles/struts-nested-iteration-tutorial.html
    It contains the reset method.
    I am interested to know how to reset the values. So am clearing the data after it has been submitted, just to reset. I assumed that once the new page was arrived at the values would be taken from the array.
    I am quite new to struts and am not familiar with example_input.action and example.action I will look into these.

  • Open JSP page by user name

    Hi Experts,
    I have a login servlet LoginServlet.java and an user welcome screen welcome.jsp. When user login and after user validation i want to open welcome.jsp like
    www.wesitename.com/username instead of www.wesitename.com/welcome.jsp. How can i do it please suggest me.
    Edited by: live_to_java on Jun 18, 2010 5:29 AM

    That's not strange cause You set welcome mapping to "/*" so it also catches your index.jsp. I've modified my code and used filter, here it goes:
    web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="2.4"
         xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
         <display-name>TestServlet</display-name>
         <filter>
              <filter-name>accessFilter</filter-name>
              <filter-class>org.opal.test.filters.AccessFilter</filter-class>
         </filter>
         <filter-mapping>
              <filter-name>accessFilter</filter-name>
              <url-pattern>/*</url-pattern>
         </filter-mapping>
         <servlet>
              <servlet-name>loginServlet</servlet-name>
              <servlet-class>org.opal.test.servlets.LoginServlet</servlet-class>
         </servlet>
         <servlet-mapping>
              <servlet-name>loginServlet</servlet-name>
              <url-pattern>/login</url-pattern>
         </servlet-mapping>
         <servlet>
              <servlet-name>index</servlet-name>
              <jsp-file>/index.jsp</jsp-file>
         </servlet>
         <servlet-mapping>
              <servlet-name>index</servlet-name>
              <url-pattern>/index/*</url-pattern>
         </servlet-mapping>
         <servlet>
              <servlet-name>welcome</servlet-name>
              <jsp-file>/welcome.jsp</jsp-file>
         </servlet>
         <servlet-mapping>
              <servlet-name>welcome</servlet-name>
              <url-pattern>/*</url-pattern>
         </servlet-mapping>
    </web-app>AccessFilter.java
    package org.opal.test.filters;
    import java.io.IOException;
    import javax.servlet.Filter;
    import javax.servlet.FilterChain;
    import javax.servlet.FilterConfig;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.ServletException;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    public class AccessFilter implements Filter {
         public void init(FilterConfig fc) throws ServletException {
         public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
              HttpServletRequest request = (HttpServletRequest) req;
              HttpServletResponse response = (HttpServletResponse) res;
              HttpSession session = request.getSession();
              String user = (String) session.getAttribute("user");
              if (request.getRequestURI().contains("login")) {
                   chain.doFilter(request, response);
                   return;
              if (user == null) {
                   RequestDispatcher rd = request.getRequestDispatcher("/index");
                   rd.forward(request, response);
              } else {
                   chain.doFilter(request, response);
                   return;
         public void destroy() {
    }LoginServlet.java
    package org.opal.test.servlets;
    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    public class LoginServlet extends HttpServlet {
         private static final long serialVersionUID = -215349891382765184L;
         @Override
         protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
              processRequest(req, resp);
         @Override
         protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
              processRequest(req, resp);
         private void processRequest(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
              HttpSession session = req.getSession();
              session.setAttribute("user", req.getParameter("login"));
              resp.sendRedirect(req.getContextPath() + "/" + req.getParameter("login"));
    }index.jsp
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
         <form action="login" method="post">
              <input type="text" value="Opal" name="login">
              <input type="submit" value="ok">
         </form>
    </body>
    </html>welcome.jsp
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
         Welcome
         ${sessionScope.user}
    </body>
    </html>

Maybe you are looking for