Validate names

Hi,
I am usig a apex items to display names, and based on the names that are displayed i am trying to use these items to update the name in the table
item name is
select wwv_flow_item.text(10,pobj.name,20,100,'readonly="yes"') name from objects
I am using this plsql to validae wheater name exist in the table or not it same name exist it must return error else no error
for c1 in (select NAME name from project_objects where pro_id = :P29_PROJ_ID) loop
if c1.name like wwv_flow.g_f10(i) then
RAISE_APPLICATION_ERROR (-20001,'Object name exist '|| wwv_flow.g_f10(i) ||' must be entered.');
END IF;
But this is checking only the first name in the not all please suggest me how do validate this
Thanks
Sudhir.

Hi,
REGEXP_LIKE ( str
         , '([[:alpha:]]).*\1.*\1'
         )returns TRUE if (and only if) the same letter of the alphabet occurs at least 3 times in str. The 3 letters don't have to be in a row. For example str='banana' would return TRUE, because 'banana' contains 3 'a's. If you want the 3 letters to be consecutive, then leave out the '.*'s.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables, and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using. REGEXP_LIKE works in Oracle 10 (and up).

Similar Messages

  • Writing Login.jsp and authenticating a user who have stored in MySql DB

    Hi Friends,
    My project requirement is: Need to write a login page must send the request to servlet is the user and password avail in mysql db, if yes servlet should forward the home page else error message. Tools i need to use is IDE=eclipse, Server = tomcat, database = MySql
    Here is source:
    pls tell me where i m wrong.
    Login.jsp
    <%@ page language="java" %>
    <html>
    <head>
    <title>Login Page</title>
    <script language = "Javascript">
    function Validate(){
    var user=document.frm.user
    var pass=document.frm.pass
    if ((user.value==null)||(user.value=="")){
    alert("Please Enter user name")
    user.focus()
    return false
    if ((pass.value==null)||(pass.value=="")){
    alert("Please Enter password")
    pass.focus()
    return false
    return true
    </script>
    </head>
    <body>
    <h1>Login
    <br>
    </h1>
    <form name="frm" action="/LoginAuthentication" method="Post" onSubmit="return Validate()" >
    Name:
    <input type="text" name="user" value=""/><br>
    Password:<input type="password" name="pass" value=""/><br>
    <br>
    <input type="submit" value="Login" />
    <input type="reset" value="forgot Password" />
    </form>
    </body>
    </html>
    Servlet Code:
    LoginAuthentication.java
    import java.io.*;
    import java.util.*;
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.ServletContext;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.http.HttpSession;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.util.List;
    import java.util.ArrayList;
    public class LoginAuthentication extends HttpServlet{
    private ServletConfig config;
    public void init(ServletConfig config)
    throws ServletException{
    this.config=config;
    //public void init() {
    // Normally you would load the prices from a database.
    //ServletContext ctx = getServletContext();
    // RequestDispatcher dispatcher = ctx.getRequestDispatcher("/HomePage.jsp");
    //dispatcher.forward(req, res);
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException,IOException{
    PrintWriter out = response.getWriter();
    String connectionURL = "jdbc:mysql://127.0.0.1/SRAT";
    //String connectionURL = "jdbc:mysql://192.168.10.59/SRAT";
    //127.0.0.1
    //http://localhost:3306/mysql
    Connection connection=null;
    ResultSet rs;
    String userName=new String("");
    String passwrd=new String("");
    response.setContentType("text/html");
    try {
    // Load the database driver
    Class.forName("com.mysql.jdbc.Driver");
    // Get a Connection to the database
    connection = DriverManager.getConnection(connectionURL, "admin", "admin");
    //Add the data into the database
    String sql = "select user,password from login";
    Statement s = connection.createStatement();
    s.executeQuery (sql);
    rs = s.getResultSet();
    while (rs.next ()){
    userName=rs.getString("user");
    passwrd=rs.getString("password");
    rs.close ();
    s.close ();
    }catch(Exception e){
    System.out.println("Exception is ;"+e);
    if(userName.equals(request.getParameter("user"))
    && passwrd.equals(request.getParameter("pass"))){
    out.println("WELCOME "+userName);
    else{
    out.println("Please enter correct username and password");
    out.println("<a href='Login.jsp'><br>Login again</a>");
    Deployment Descriptor for TOMCAT
    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>
    SRAT</display-name>
    <welcome-file-list>
    <welcome-file>login.jsp</welcome-file>
    </welcome-file-list>
    <servlet>
    <servlet-name>LoginAuthentication</servlet-name>
    <servlet-class>LoginAuthentication</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>LoginAuthentication</servlet-name>
    <url-pattern>/LoginAuthentication</url-pattern>
    </servlet-mapping>
    </web-app>
    PLS HELP ME.
    S. Udaya Chandrika

    I too have used the same code but its giving the following error:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Wrapper cannot find servlet class Validation or a class it depends on
         org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
         org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
         org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
         org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
         java.lang.Thread.run(Unknown Source)
    root cause
    java.lang.ClassNotFoundException: Validation
         org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
         org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
         org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
         org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
         org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
         org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
         java.lang.Thread.run(Unknown Source)
    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.
    Apache Tomcat/6.0.18
    Please some one help??

  • Need help finding whats wrong with my servlet

    I've been trying to create a simple login page following the tutorial found http://www.roseindia.net/mysql/loginauthentication.shtml
    There is a single JSP (AuthenticateLogin.jsp) and a servlet (LoginAuthentication.java). Basically what has to happen is the user enters the login information in the JSP which sends these info to the servlet. The servlet checks whether the username and password exist in the table and if they do it displays the user if not it says to that the username and/or password is invalid. I'm using IntelliJ IDEA as the IDE, Tomcat as the application server and MySQL 5.0.18 for the database. I'm also using Ant as a build tool.
    The following are my code:
    AuthenticateLogin.jsp
    <head>
         <title>Login Page</title>
         <script type="text/javascript">
              function validate() {
                   var user = document.frm.user
                   var pass = document.frm.pass
                   if ((user == null) || (user == "")) {
                        alert("Please enter a username")
                        user.focus()
                        return false
                   if ((pass == null) || (pass == "")) {
                        alert("Please enter a password")
                        pass.focus()
                        return false
         </script>
    </head>
    <body>
    <form name="frm" action="LoginAuthentication" method="post" onsubmit="return validate()">
         Name:       <input type="text" name="user"/>
         <br/>
         Password:   <input type="text" name="pass" />
         <br />
         <input type="submit" value="Sign in"/>     
         <input type="reset" value="Reset"/>
    </form>
    </body>
    </html>{code}
    LoginAuthentication.java
    {code:java}import java.io.*;*
    *import java.sql.*;
    import javax.servlet.*;*
    *import javax.servlet.http.*;
    public class LoginAuthentication extends HttpServlet {
         private ServletConfig config;
         public void init (ServletConfig config) throws ServletException {
              this.config = config;
         public void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
              PrintWriter out = response.getWriter();
              String connectionUrl = "jdbc:mysql://192.168.0.95:3306/loginTester";
              Connection connection = null;
              ResultSet rs;
              String userName = new String("");
              String passwrd = new String("");
              response.setContentType("text/html");
              try {
                   Class.forName("com.mysql.jdbc.Driver");
                   connection = DriverManager.getConnection(connectionUrl, "root", "");
                   String sql = "select user, password from user";
                   Statement s = connection.createStatement();
                   s.executeQuery(sql);
                   rs = s.getResultSet();
                   while (rs.next()) {
                        userName = rs.getString("user");
                        passwrd = rs.getString("password");
                   rs.close();
                   s.close();
              } catch (Exception e){
                   System.out.println("Exception thrown: ["+e+"}");
              if (userName.equals(request.getParameter("user")) && passwrd.equals(request.getParameter("pass"))) {
    //               response.sendRedirect("http://localhost:8080/xplanner_reports/");
                   out.println("Hello"+userName);
              } else {
                   out.println("Please enter a valid username and password");
                   out.println("<a href='AuthenticateLogin.jsp'><br/>Login again</a>");
    }{code}
    web.xml
    {code:java}<?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/javaee"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
                 version="2.5">
         <welcome-file-list>
              <welcome-file>AuthenticateLogin.jsp</welcome-file>
         </welcome-file-list>
         <servlet>
              <servlet-name>LoginAuthentication</servlet-name>
              <servlet-class>LoginAuthentication</servlet-class>
         </servlet>
         <servlet-mapping>
              <servlet-name>LoginAuthentication</servlet-name>
              <url-pattern>/LoginAuthentication</url-pattern>
         </servlet-mapping>
    </web-app>
    </web-app>{code}
    The problem I'm facing is the validation (checking whether the username and password match to those in the database) isn't working properly. No matter what I enter as the username and password (even if it is the correct pair) it always shows as my username and/or password is invalid. When I check the tomcat (catalina) log the following entry was found:
    {code:java}Exception thrown: [java.lang.ClassNotFoundException: com.mysql.jdbc.Driver}{code}
    Could someone please show me what I could be doing wrong here? It would be a great help.  Spent a day trying to figure this out :no:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    How could I add it to my classpath from Idea?
    By the way the following is my build.xml (ant build file)
    <project name="LoginForm" basedir=".">
        <property name="app.name" value="LoginForm"/>
        <property name="src.dir" location="src"/>
        <property name="build.dir" location="build"/>
        <property name="build.webinf.classes.dir" location="${build.dir}/WEB-INF/classes"/>
        <property name="web.dir" location="web"/>
        <property name="dist.dir" location="dist"/>
        <property name="lib.dir" location="lib"/>
        <property name="tomcat.home" location="/home/ruzaik/software/tomcat/apache-tomcat-5.5.20"/>
        <property name="tomcat.url" value="http://localhost:8080/manager"></property>
        <property name="tomcat.username" value="tomcat"/>
        <property name="tomcat.passward" value="tomcat"/>
        <property name="appserver.deploy.dir" location="${tomcat.url}/webapps"></property>
        <property name="war.file" value="${app.name}.war"/>
        <import file="${tomcat.home}/bin/catalina-tasks.xml"/>
        <path id="project.classpath">
            <dirset dir="${build.dir}"/>
            <fileset dir="${lib.dir}">
                <include name="**/*.jar"/>
            </fileset>
        </path>
        <target name="clean" description="Cleans directories">
            <delete dir="${build.dir}"/>
            <delete dir="${dist.dir}"/>
        </target>
        <target name="init" depends="clean" description="Creates directories">
            <mkdir dir="${build.dir}"/>
            <mkdir dir="${build.webinf.classes.dir}"/>
            <mkdir dir="${dist.dir}" />
        </target>
        <target name="compile" depends="init">
            <javac srcdir="${src.dir}" destdir="${build.webinf.classes.dir}">
                <classpath refid="project.classpath"/>
            </javac>
        </target>
        <target name="copy" description=" : Copy the content of web in to build directoy">
            <copy todir="${build.dir}" preservelastmodified="yes" overwrite="yes">
                <fileset dir="${web.dir}">
                    <include name="**/*"/>
                    <exclude name="**/*.bak"/>
                </fileset>
            </copy>
        </target>
        <target name="war" depends="compile, copy" description=" : Create a war file for deploying">
            <jar destfile="${dist.dir}/${app.name}.war" update="false" compress="true">
                <fileset dir="${build.dir}">
                    <include name="**/*"/>
                </fileset>
            </jar>
        </target>
        <target name="install">
            <deploy url="${tomcat.url}" username="tomcat" password="tomcat" path="/LoginForm"
                    war="${dist.dir}/${war.file}">
            </deploy>
        </target>
        <target name="uninstall">
            <undeploy url="${tomcat.url}" username="tomcat" password="tomcat" path="/LoginForm">
            </undeploy>
        </target>
    </project>and my directory structure could be found here http://img407.imageshack.us/img407/1594/tempf.png
    I think I"ve added it to the classpath.

  • Sending variables via the e-mail report

    I don't have an LMS, so I'm sending via e-mail some courses to my coworkers and getting their answers via the e-mail report, one of the problems with this is that I cannot  validate name, last name, user's e-mail, and business unit automatically.
    Once I get the answers I copy and paste the results in Excel in order to do the grading and analysis, I do it this way because the Quiz results analyzer either gives only the final grade or shows each anser student by student.
    The way I solved this before was adding a question slide for each field and making them survey questions, the issue with this is that the users need to fill 4 or 5 fields and if I use questions it also means 4 or 5 pages.
    Is there a way to fill this information using Text Entry Boxes and sending the content via the e-mail report using variables?
    As far as I know this was not possible in previous versions of Captivate, I just upgraded to 5.5
    Thanks

    Look for iPhoto in the lower left under media in the upload window
    click here for an expanded discussion of the many options for accessing your iPhoto library safely.
    LN

  • How to convert resultset variable to integer variable

    hii..i am making a jsp page in which i get the name of the product from the available products in the database and i give the quantity of the product from the jsp page which get stored in the database.Now the problem is when i give I want that only the product which i want come to the screen from the available products..for this i had made a combobox which selects the next item I want,but it is not working.Can anyone help me out.I am wriiting the code which I have written,Although it's not working.
    <%@page language="java"%>
    <%@page import="java.sql.*"%>
    <%@page import="connect.connection"%>
    <%
    String productId = request.getParameter("pname")==null? "": request.getParameter("pname");
    String strQuantity="";
    %>
    <%
         Connection con1=null;
         connection conn1=null;
         con1=conn1.getconnection();
         Statement st=null;
         ResultSet rs=null;
         st=con1.createStatement();
    %>
    <!--<script>
    function subject()
    document.registration.action="buyerForm2.jsp";
    //document.registration.submit();
    </script>-->
    <HTML>
    <HEAD>
    <TITLE>Shree Cement : Register Buyer</TITLE>
    <script language="javascript" src="../js/buyervalidate.js"></script>
    </HEAD>
    <body bgColor=3F7790 text=#000000 topMargin=12 border="0">
    <!-- Begin header section -->
    <jsp:include page="../header/header.jsp" />
    <!-- End header section -->
    <table width="800" align="center" border="0">
    <tr>
    <td bgcolor="#EBEBEB" width="135" valign="top">
         <!--Begin left nav section-->
              <jsp:include page="../include/left-nav-main.jsp" />
              <!-- End left nav section-->
    </td>
    <!--main section of pp Buyer-->
         <br>
    <td rowspan=7 valign=top width="58%" align="center">
         <table>
                        <tr>
                        <td class="img">Registration Form</td>
    <td width="60%"></td>
    <td align="left" class="img1">Buyer</td>
                        </tr>
         </table>
    <form name="login" method="post">
    <table cellpadding=3 class="pp">
    <tr>
    <td>Online bid date :</td>
    <td colspan=3 >
    <select name="monthonline" class="formfield1" value="month" >
    <option value="Month">-Month-
    <option value=1> January
    <option value=2>February
    <option value=3>March
    <option value=4>April
    <option value=5> May
    <option value=6> June
    <option value=7> July
    <option value=8> August
    <option value=9> September
    <option value=10> October
    <option value=11> November
    <option value=12> December
    </select>
              </td>
                   <td colspan=3 >
    <select name="dateonline" class="formfield1" value="date">
    <option value="Day">-Day-
    <option value=1>1
    <option value=2>2
    <option value=3>3
    <option value=4>4
    <option value=5>5
    <option value=6>6
    <option value=7>7
    <option value=8>8
    <option value=9>9
    <option value=10>10
    <option value=11>11
    <option value=12>12
    <option value=13>13
    <option value=14>14
    <option value=15>15
    <option value=16>16
    <option value=17>17
    <option value=18>18
    <option value=19>19
    <option value=20>20
    <option value=21>21
    <option value=22>22
    <option value=23>23
    <option value=24>24
    <option value=25>25
    <option value=26>26
    <option value=27>27
    <option value=28>28
    <option value=29>29
    <option value=30>30
    <option value=31>31
    </select>
                   </td>
                   <td >
    <select name="yearonline" class="formfield1" value="year" align="left">
    <option value="Year">-Year-
    <option value=2003>2003
    <option value=2004>2004
    <option value=2005>2005
    <option value=2006>2006
    <option value=2007>2007
    <option value=2008>2008
    <option value=2009>2009
    <option value=2010>2010
    </select>
    </td>
    </tr>
    <tr>
    <td>Start time :</td>
    <td colspan=3 width="296">
    <select name="starttime" class="formfield1" size=1>
    <option selected value="08:00:00">8 : 00 am
    <option value="08:15:00">8 : 15 am
    <option value="08:30:00">8 : 30 am
    <option value="08:45:00">8 : 45 am
    <option value="09:00:00">9 : 00 am
    <option value="09:15:00">9 : 15 am
    <option value="09:30:00">9 : 30 am
    <option value="09:45:00">9 : 45 am
    <option value="10:00:00">10 : 00 am
    <option value="10:15:00">10 : 15 am
    <option value="10:30:00">10 : 30 am
    <option value="10:45:00">10 : 45 am
    <option value="11:00:00">11 : 00 am
    <option value="11:15:00">11 : 15 am
    <option value="11:30:00">11 : 30 am
    <option value="11:45:00">11 : 45 am
    <option value="12:00:00">12 : 00 pm
    <option value="12:15:00">12 : 15 pm
    <option value="12:30:00">12 : 30 pm
    <option value="12:45:00">12 : 45 pm
    <option value="13:00:00">1 : 00 pm
    <option value="13:15:00">1 : 15 pm
    <option value="13:30:00">1 : 30 pm
    <option value="13:45:00">1 : 45 pm
    <option value="14:00:00">2 : 00 pm
    <option value="14:15:00">2 : 15 pm
    <option value="14:30:00">2 : 30 pm
    <option value="14:45:00">2 : 45 pm
    <option value="15:00:00">3 : 00 pm
    <option value="15:15:00">3 : 15 pm
    <option value="15:30:00">3 : 30 pm
    <option value="15:45:00">3 : 45 pm
    <option value="16:00:00">4 : 00 pm
    <option value="16:15:00">4 : 15 pm
    <option value="16:30:00">4 : 30 pm
    <option value="16:45:00">4 : 45 pm
    <option value="17:00:00">5 : 00 pm
    <option value="17:15:00">5 : 15 pm
    <option value="17:30:00">5 : 30 pm
    <option value="17:45:00">5 : 45 pm
    <option value="18:00:00">6 : 00 pm
    <option value="18:15:00">6 : 15 pm
    <option value="18:30:00">6 : 30 pm
    <option value="18:45:00">6 : 45 pm
    <option value="19:00:00">7 : 00 pm
    <option value="19:15:00">7 : 15 pm
    <option value="19:30:00">7 : 30 pm
    <option value="19:45:00">7 : 45 pm
    <option value="20:00:00">8 : 00 pm
    </select>
    </td>
    </tr>
    <tr>
    <td>End
    time :</td>
    <td colspan=3 width="296">
    <select name="endtime" class="formfield1" size=1><br>
    <option selected value="08:00:00">8 : 00 am
    <option value="08:15:00">8 : 15 am
    <option value="08:30:00">8 : 30 am
    <option value="08:45:00">8 : 45 am
    <option value="09:00:00">9 : 00 am
    <option value="09:15:00">9 : 15 am
    <option value="09:30:00">9 : 30 am
    <option value="09:45:00">9 : 45 am
    <option value="10:00:00">10 : 00 am
    <option value="10:15:00">10 : 15 am
    <option value="10:30:00">10 : 30 am
    <option value="10:45:00">10 : 45 am
    <option value="11:00:00">11 : 00 am
    <option value="11:15:00">11 : 15 am
    <option value="11:30:00">11 : 30 am
    <option value="11:45:00">11 : 45 am
    <option value="12:00:00">12 : 00 pm
    <option value="12:15:00">12 : 15 pm
    <option value="12:30:00">12 : 30 pm
    <option value="12:45:00">12 : 45 pm
    <option value="13:00:00">1 : 00 pm
    <option value="13:15:00">1 : 15 pm
    <option value="13:30:00">1 : 30 pm
    <option value="13:45:00">1 : 45 pm
    <option value="14:00:00">2 : 00 pm
    <option value="14:15:00">2 : 15 pm
    <option value="14:30:00">2 : 30 pm
    <option value="14:45:00">2 : 45 pm
    <option value="15:00:00">3 : 00 pm
    <option value="15:15:00">3 : 15 pm
    <option value="15:30:00">3 : 30 pm
    <option value="15:45:00">3 : 45 pm
    <option value="16:00:00">4 : 00 pm
    <option value="16:15:00">4 : 15 pm
    <option value="16:30:00">4 : 30 pm
    <option value="16:45:00">4 : 45 pm
    <option value="17:00:00">5 : 00 pm
    <option value="17:15:00">5 : 15 pm
    <option value="17:30:00">5 : 30 pm
    <option value="17:45:00">5 : 45 pm
    <option value="18:00:00">6 : 00 pm
    <option value="18:15:00">6 : 15 pm
    <option value="18:30:00">6 : 30 pm
    <option value="18:45:00">6 : 45 pm
    <option value="19:00:00">7 : 00 pm
    <option value="19:15:00">7 : 15 pm
    <option value="19:30:00">7 : 30 pm
    <option value="19:45:00">7 : 45 pm
    <option value="20:00:00">8 : 00 pm
    </select>
    </td>
    </tr>
              </table>
              <table class="log" cellpadding=3 cellspacing=0 border="0">
         <% String strname="";
              rs=st.executeQuery("select name from product");
              if(rs.next())
    strname=rs.getString(1);
    %>
              <tr>     
              <td align="left"><%=strname%></td>
              <td></td>
    <td>Quantity(in lacs):</td>
    <td><input type="text" class="formfield" name="items2" onkeypress="if(event.keyCode >47 && event.keyCode < 58){event.returnValue = true;} else{event.returnValue = false;}"></td>
              </tr>
              <tr>          
    <td>Select Product Name :</td>
              <td></td>
    <td>
    <select name="pname"><option>select</option>
              <%
                        String username="";
                        rs=st.executeQuery("select name from product");
                        while(rs.next())
    username = rs.getString(1);
              %>
    <option <%if(productId.equals(username)){%> <%}%>><%=username%></option>
    <% } %>
              </select>
              </td>
    </tr>
              <%          
                        int count=1;
                        rs=st.executeQuery("select max(auction_id) from auction1");
         int num = Integer.parseInt(pageContext.findAttribute("num").toString());
                        out.println(num);
                        //for(count=1;count < num;count++)
                             //out.println(rs);
                        String name="";          
                             rs=st.executeQuery("select name from product where name='"+username+"'");
                             //out.println(rs);
                             if(rs.next())
                                  name=rs.getString(1);
                             if(name.equals(username))
                             {%>
                                  <tr>
                                  <td align="left"><%=name%></td>
                                  <td>Quantity(in lacs):</td>
                                  <td><input type="text" class="formfield" name="items2" onkeypress="if(event.keyCode > 47 && event.keyCode < 58){event.returnValue = true;} else{event.returnValue = false;}"></td>
                                  </tr>
              <%}
              %>
    </table>
              <table cellpadding="5" align="center" bgcolor=#FFFFFF width="397">
    <tr>
                   <td>
                        <input type="submit" value="Add more Items" onClick="add();">
                   </td>
                   <td width="115"align="right">
                        <input type="submit" value="Continue"onClick="return validate();" name="submit">
                   </td>
    <td>
                        <input type="reset" value="Clear all fields" name="reset">
    </td>
    </tr>
    </table>
         </form>               
    </td>
    <!-- End Main section -->
    <td width="23%" valign="top" bgcolor="#EBEBEB" border="0">
         <!--Begin right nav section-->
              <jsp:include page="../include/rightbar2.jsp" />          
              <!-- End right nav section -->
              </td>
    <!-- Begin footer section -->
    <jsp:include page="../footer/footer.jsp" />
    <!-- End footer section -->

    It's highly recommended to use any business, logic and DB access tasks in a Servlet. JSP should be used only to display HTML forms/results.
    <%@page language="java"%>
    <%@page import="java.sql.*"%>
    <%@page import="connect.connection"%>
    <% String productId = request.getParameter("pname")==null? "": request.getParameter("pname"); String strQuantity=""; %>
    <% Connection con1=null; connection conn1=null; con1=conn1.getconnection(); Statement st=null; ResultSet rs=null; st=con1.createStatement(); %>
    <!--<script> function subject() { document.registration.action="buyerForm2.jsp"; //document.registration.submit(); } </script>-->
    <HTML>
    <HEAD>
    <TITLE>Shree Cement : Register Buyer</TITLE>
    <script language="javascript" src="../js/buyervalidate.js"></script>
    </HEAD>
    <body bgColor=3F7790 text=#000000 topMargin=12 border="0">
    <!-- Begin header section -->
    <jsp:include page="../header/header.jsp" />
    <!-- End header section -->
    <table width="800" align="center" border="0">
         <tr>
              <td bgcolor="#EBEBEB" width="135" valign="top"><!--Begin left nav section--> <jsp:include
                   page="../include/left-nav-main.jsp" /> <!-- End left nav section--></td>
              <!--main section of pp Buyer-->
              <td rowspan=7 valign=top width="58%" align="center">
              <table>
                   <tr>
                        <td class="img">Registration Form</td>
                        <td width="60%"></td>
                        <td align="left" class="img1">Buyer</td>
                   </tr>
              </table>
              <form name="login" method="post">
              <table cellpadding=3 class="pp">
                   <tr>
                        <td>Online bid date :</td>
                        <td colspan=3><select name="monthonline" class="formfield1" value="month">
                             <option value="Month">-Month-
                             <option value=1>January
                             <option value=2>February
                             <option value=3>March
                             <option value=4>April
                             <option value=5>May
                             <option value=6>June
                             <option value=7>July
                             <option value=8>August
                             <option value=9>September
                             <option value=10>October
                             <option value=11>November
                             <option value=12>December
                        </select></td>
                        <td colspan=3><select name="dateonline" class="formfield1" value="date">
                             <option value="Day">-Day-
                             <option value=1>1
                             <option value=2>2
                             <option value=3>3
                             <option value=4>4
                             <option value=5>5
                             <option value=6>6
                             <option value=7>7
                             <option value=8>8
                             <option value=9>9
                             <option value=10>10
                             <option value=11>11
                             <option value=12>12
                             <option value=13>13
                             <option value=14>14
                             <option value=15>15
                             <option value=16>16
                             <option value=17>17
                             <option value=18>18
                             <option value=19>19
                             <option value=20>20
                             <option value=21>21
                             <option value=22>22
                             <option value=23>23
                             <option value=24>24
                             <option value=25>25
                             <option value=26>26
                             <option value=27>27
                             <option value=28>28
                             <option value=29>29
                             <option value=30>30
                             <option value=31>31
                        </select></td>
                        <td><select name="yearonline" class="formfield1" value="year" align="left">
                             <option value="Year">-Year-
                             <option value=2003>2003
                             <option value=2004>2004
                             <option value=2005>2005
                             <option value=2006>2006
                             <option value=2007>2007
                             <option value=2008>2008
                             <option value=2009>2009
                             <option value=2010>2010
                        </select></td>
                   </tr>
                   <tr>
                        <td>Start time :</td>
                        <td colspan=3 width="296"><select name="starttime" class="formfield1" size=1>
                             <option selected value="08:00:00">8 : 00 am
                             <option value="08:15:00">8 : 15 am
                             <option value="08:30:00">8 : 30 am
                             <option value="08:45:00">8 : 45 am
                             <option value="09:00:00">9 : 00 am
                             <option value="09:15:00">9 : 15 am
                             <option value="09:30:00">9 : 30 am
                             <option value="09:45:00">9 : 45 am
                             <option value="10:00:00">10 : 00 am
                             <option value="10:15:00">10 : 15 am
                             <option value="10:30:00">10 : 30 am
                             <option value="10:45:00">10 : 45 am
                             <option value="11:00:00">11 : 00 am
                             <option value="11:15:00">11 : 15 am
                             <option value="11:30:00">11 : 30 am
                             <option value="11:45:00">11 : 45 am
                             <option value="12:00:00">12 : 00 pm
                             <option value="12:15:00">12 : 15 pm
                             <option value="12:30:00">12 : 30 pm
                             <option value="12:45:00">12 : 45 pm
                             <option value="13:00:00">1 : 00 pm
                             <option value="13:15:00">1 : 15 pm
                             <option value="13:30:00">1 : 30 pm
                             <option value="13:45:00">1 : 45 pm
                             <option value="14:00:00">2 : 00 pm
                             <option value="14:15:00">2 : 15 pm
                             <option value="14:30:00">2 : 30 pm
                             <option value="14:45:00">2 : 45 pm
                             <option value="15:00:00">3 : 00 pm
                             <option value="15:15:00">3 : 15 pm
                             <option value="15:30:00">3 : 30 pm
                             <option value="15:45:00">3 : 45 pm
                             <option value="16:00:00">4 : 00 pm
                             <option value="16:15:00">4 : 15 pm
                             <option value="16:30:00">4 : 30 pm
                             <option value="16:45:00">4 : 45 pm
                             <option value="17:00:00">5 : 00 pm
                             <option value="17:15:00">5 : 15 pm
                             <option value="17:30:00">5 : 30 pm
                             <option value="17:45:00">5 : 45 pm
                             <option value="18:00:00">6 : 00 pm
                             <option value="18:15:00">6 : 15 pm
                             <option value="18:30:00">6 : 30 pm
                             <option value="18:45:00">6 : 45 pm
                             <option value="19:00:00">7 : 00 pm
                             <option value="19:15:00">7 : 15 pm
                             <option value="19:30:00">7 : 30 pm
                             <option value="19:45:00">7 : 45 pm
                             <option value="20:00:00">8 : 00 pm
                        </select></td>
                   </tr>
                   <tr>
                        <td>End time :</td>
                        <td colspan=3 width="296"><select name="endtime" class="formfield1" size=1>
                             <option selected value="08:00:00">8 : 00 am
                             <option value="08:15:00">8 : 15 am
                             <option value="08:30:00">8 : 30 am
                             <option value="08:45:00">8 : 45 am
                             <option value="09:00:00">9 : 00 am
                             <option value="09:15:00">9 : 15 am
                             <option value="09:30:00">9 : 30 am
                             <option value="09:45:00">9 : 45 am
                             <option value="10:00:00">10 : 00 am
                             <option value="10:15:00">10 : 15 am
                             <option value="10:30:00">10 : 30 am
                             <option value="10:45:00">10 : 45 am
                             <option value="11:00:00">11 : 00 am
                             <option value="11:15:00">11 : 15 am
                             <option value="11:30:00">11 : 30 am
                             <option value="11:45:00">11 : 45 am
                             <option value="12:00:00">12 : 00 pm
                             <option value="12:15:00">12 : 15 pm
                             <option value="12:30:00">12 : 30 pm
                             <option value="12:45:00">12 : 45 pm
                             <option value="13:00:00">1 : 00 pm
                             <option value="13:15:00">1 : 15 pm
                             <option value="13:30:00">1 : 30 pm
                             <option value="13:45:00">1 : 45 pm
                             <option value="14:00:00">2 : 00 pm
                             <option value="14:15:00">2 : 15 pm
                             <option value="14:30:00">2 : 30 pm
                             <option value="14:45:00">2 : 45 pm
                             <option value="15:00:00">3 : 00 pm
                             <option value="15:15:00">3 : 15 pm
                             <option value="15:30:00">3 : 30 pm
                             <option value="15:45:00">3 : 45 pm
                             <option value="16:00:00">4 : 00 pm
                             <option value="16:15:00">4 : 15 pm
                             <option value="16:30:00">4 : 30 pm
                             <option value="16:45:00">4 : 45 pm
                             <option value="17:00:00">5 : 00 pm
                             <option value="17:15:00">5 : 15 pm
                             <option value="17:30:00">5 : 30 pm
                             <option value="17:45:00">5 : 45 pm
                             <option value="18:00:00">6 : 00 pm
                             <option value="18:15:00">6 : 15 pm
                             <option value="18:30:00">6 : 30 pm
                             <option value="18:45:00">6 : 45 pm
                             <option value="19:00:00">7 : 00 pm
                             <option value="19:15:00">7 : 15 pm
                             <option value="19:30:00">7 : 30 pm
                             <option value="19:45:00">7 : 45 pm
                             <option value="20:00:00">8 : 00 pm
                        </select></td>
                   </tr>
              </table>
              <table class="log" cellpadding=3 cellspacing=0 border="0">
                   <%      String strname="";
                        rs=st.executeQuery("select name from product");
                        if(rs.next()) {
                             strname=rs.getString(1);
                   %>
                   <tr>
                        <td align="left"><%=strname%></td>
                        <td></td>
                        <td>Quantity(in lacs):</td>
                        <td><input type="text" class="formfield" name="items2"
                             onkeypress="if(event.keyCode >47 && event.keyCode < 58){event.returnValue = true;} else{event.returnValue = false;}"></td>
                   </tr>
                   <tr>
                        <td>Select Product Name :</td>
                        <td></td>
                        <td><select name="pname">
                             <option>--select--</option>
                             <%
                                  String username="";
                                  rs=st.executeQuery("select name from product");
                                  while(rs.next()) { username = rs.getString(1); %>
                                  <option>
                                       <%if(productId.equals(username)){%>
                                       <%}%>
                                       <%=username%>
                                       </option>
                             <% } %>
                        </select></td>
                   </tr>
                   <%
                        int count=1;
                        rs=st.executeQuery("select max(auction_id) from auction1");
                        int num = Integer.parseInt(pageContext.findAttribute("num").toString());
                        out.println(num);
                        //for(count=1;count < num;count++) //{ //out.println(rs); String name=""; rs=st.executeQuery("select name from product where name='"+username+"'"); //out.println(rs); if(rs.next()) { name=rs.getString(1); } //} if(name.equals(username)) {
                   %>
                   <tr>
                        <td align="left"><%=num%></td>
                        <td>Quantity(in lacs):</td>
                        <td><input type="text" class="formfield" name="items2"
                             onkeypress="if(event.keyCode > 47 && event.keyCode < 58){event.returnValue = true;} else{event.returnValue = false;}"></td>
                   </tr>
              </table>
              <table cellpadding="5" align="center" bgcolor=#FFFFFF width="397">
                   <tr>
                        <td><input type="submit" value="Add more Items" onClick="add();"></td>
                        <td width="115" align="right"><input type="submit" value="Continue" onClick="return validate();" name="submit">
                        </td>
                        <td><input type="reset" value="Clear all fields" name="reset"></td>
                   </tr>
              </table>
              </form>
              </td>
              <!-- End Main section -->
              <td width="23%" valign="top" bgcolor="#EBEBEB" border="0"><!--Begin right nav section-->
              <jsp:include page="../include/rightbar2.jsp" /> <!-- End right nav section --></td>
              <!-- Begin footer section -->
              <jsp:include page="../footer/footer.jsp" />
              <!-- End footer section -->

  • How to catch the exact validation fault message?

    Hi experts,
    I would like to catch the exact validation fault message.
    If the validate operation fails then I get the next SOAP Fault:
    <env:Fault xmlns:ns0="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
    <faultcode>ns0:invalidVariables</faultcode>
    <faultstring>faultName: {{http://docs.oasis-open.org/wsbpel/2.0/process/executable}invalidVariables}
    messageType: {{http://schemas.oracle.com/bpel/extension}RuntimeFaultMessage}</faultstring>
    <faultactor/>
    <detail>
    <exception/>
    </detail>
    </env:Fault>
    However In the enterprise manager (audit trail) I can see the next message at the failed validate operation:
    Invalid data: The value for variable "req_ProcessAdjustmentOp", part "bodyUPI" does not match the schema definition for this part Invalid text '?' in element: 'date'. The invalid xml document is shown below:
    I would like to send back this message to the service consumer as it contains more information about the error. How could I do that? I've already tried the ora:getFaultAsString() function but I got the original fault.
    Thanks,
    Viktor

    Hi Arik,
    I tried to catch the invalidVariables exception but I couldn't... Here is my BPEL source would you be so kind to have a look at it?
    Thanks!
        <scope name="Scope_validate_req_ReceiveAdjustmentOp" exitOnStandardFault="no">
          <variables>
            <variable name="v_RuntimeFaultMessage" messageType="bpelx:RuntimeFaultMessage"/>
          </variables>
          <faultHandlers>
            <catch faultName="bpel:invalidVariables"
                   faultVariable="v_RuntimeFaultMessage"
                   faultMessageType="bpelx:RuntimeFaultMessage">
              <sequence>
                <empty name="Empty2"/>
                <assign name="Assign1"
                        xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
                  <copy>
                    <from>$v_RuntimeFaultMessage.detail</from>
                    <to>$f_validate</to>
                  </copy>
                </assign>
                <rethrow name="Rethrow1"
                         xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"/>
              </sequence>
            </catch>
            <catch faultName="bpelx:invalidVariables"
                   faultVariable="v_RuntimeFaultMessage"
                   faultMessageType="bpelx:RuntimeFaultMessage">
              <sequence name="Sequence5">
                <empty name="Empty3"/>
                <assign name="Assign1">
                  <copy>
                    <from>$v_RuntimeFaultMessage.detail</from>
                    <to>$f_validate</to>
                  </copy>
                </assign>
                <rethrow name="Rethrow1"/>
              </sequence>
            </catch>
          </faultHandlers>
          <sequence name="Sequence4">
            <if name="by_operation">
              <documentation>sv_operation = "ProcessAdjustment"</documentation>
              <condition>$sv_operation = $C_OP_ProcessAdjustment</condition>
              <sequence name="Sequence6">
                <empty name="Empty4"/>
                <validate name="Validate_req_ReceiveAdjustmentOp"
                          variables="req_ProcessAdjustmentOp"/>
              </sequence>
              <elseif>
                <documentation>sv_operation = "ProcessReceipt"</documentation>
                <condition>$sv_operation = $C_OP_ProcessReceipt</condition>
                <empty name="Empty1"/>
              </elseif>
            </if>
          </sequence>
        </scope>

  • Server side form validation

    Hi exprets.
    How can i validate a form with jsp without the involvement of any client side script so that when a field is not filled properly it should display the form again with the data filled previously and a message against the incorrect field.
    I have a generic asp code that can be used with any form. There are some complexities in it for me in converting it to jsp because I am very net to it.
    Here is the asp code:
    validateForm.asp
    <%
    const errorSymbol = "<font color=red><b>*</b></font>"
    dim dicError
    set dicError = server.createObject("scripting.dictionary")
    sub checkForm
    dim fieldName, fieldValue, pFieldValue
    for each field in request.form
    if left(field, 1) = "_" then
    ' is validation field , obtain field name
    fieldName = right( field, len( field ) - 1)
    ' obtain field value
    fieldValue = request.form(field)
    select case lCase(fieldValue)
    case "required"
    if trim(request.form(fieldName)) = "" then
    dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & " is required</font>"
    end if
    case "date"
    if Not isDate(request.form(fieldName)) then
    dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & "must be a date</font>"
    end if
    case "number"
    pFieldValue=request.form(fieldName)
    if Not isNumeric(pFieldValue) or (instr(pFieldValue,",")<>0) then
    dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & " must be a number</font>"
    end if
    case "intnumber"
    pFieldValue=request.form(fieldName)
    if Not isNumeric(pFieldValue) or (instr(pFieldValue,",")<>0) or (instr(pFieldValue,".")<>0) then
    dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & " must be an integer</font>"
    end if
    case "email"
    if instr(request.form(fieldName),"@")=0 or instr(request.form(fieldName),".")=0 then
    dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & " must be an email</font>"
    end if
    case "phone"
    pFieldValue=request.form(fieldName)
    pFieldValue=replace(pFieldValue," ","")
    pFieldValue=replace(pFieldValue,"-","")
    pFieldValue=replace(pFieldValue,"(","")
    pFieldValue=replace(pFieldValue,")","")
    pFieldValue=replace(pFieldValue,"+","")
    if Not isNumeric(pFieldValue) then
    dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & " must be a phone number</font>"
    end if
    case "login"
    Dim i, ch, login
    login = false
    pFieldValue = request.Form(fieldName)
    if len(pFieldValue) < 5 then
         login = false
    else
              for i=1 to len(pFieldValue)     
              ch = Mid(pFieldValue, i, 1)
                   if i=1 then
                        if(((ch >= "A") and (ch <= "Z")) or((ch >= "a") and (ch <= "z"))) then
                             login = true
                        else
                             login = false
                             exit for
                        end if
                   end if
                   if (i > 1) then
                        if(((ch >= "A")and(ch <= "Z"))or((ch >= "a")and(ch <= "z"))or((ch >= "0")and(ch <= "9"))or(ch = "_")) then
                             login = true
                        else
                             login = false
                             exit for
                        end if
                   end if
              next
         end if
         if login = false then
    dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & " must start with an alphabet, having numbers (0-9), alphabets, the underscore and no spaces</font>"
    end if
    end select
    end if
    next
    end sub
    sub validateForm2(byVal successPage)
    if request.ServerVariables("CONTENT_LENGTH") > 0 then
    checkForm
    ' if no errors, then successPage
    if dicError.Count = 0 then
    ' build success querystring
    tString=Cstr("")
    for each field in request.form
    if left(field, 1) <> "_" then
    fieldName = field
    fieldValue = request.form(fieldName)
    tString=tString &fieldName& "=" &Server.UrlEncode(fieldValue)& "&"
    end if
    next
    Dim PageRed
    PageRed= successPage&"?"& tString
    response.Redirect(PageRed)
    end if
    end if
    end sub
    sub validateError
    dim countRow
    countRow=cInt(0)
    for each field in dicError
    if countRow=0 then
    response.write "<br>"
    end if
    response.write "<br> - " & dicError(field)
    countRow=countRow+1
    next
    if countRow>0 then
    response.write "<br>"
    end if
    end sub
    sub validate( byVal fieldName, byVal validType )
    %> <input name="_<%=fieldName%>" type="hidden" value="<%=validType%>"> <%
    if dicError.Exists(fieldName) then
    response.write errorSymbol
    end if
    end sub
    sub textbox(byVal fieldName , byVal fieldValue, byVal fieldSize, byVal fieldType, byVal fieldTitle, byVal maxLength, byVal action)
    dim lastValue
    lastValue = request.form(fieldName)
    select case fieldType
    case "textbox"
    %>
    <input name="<%=fieldName%>" size="<%=fieldSize%>" value="<%
    if trim(fieldValue)<>"" then
    response.write fieldValue
    else
    response.write Server.HTMLEncode(lastValue)
    end if%>" style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid;"
    title="<%=fieldTitle%>" maxlength="<%=maxLength%>" <%=action%>>
    <%
    case "hidden"
    %>
    <input type="hidden" name="<%=fieldName%>" size="<%=fieldSize%>" value="<%
    if trim(fieldValue)<>"" then
    response.write fieldValue
    else
    response.write Server.HTMLEncode(lastValue)
    end if%>">
    <%
    case "password"
    %><input name="<%=fieldName%>" type="password" size="<%=fieldSize%>" value="<%
    if trim(fieldValue)<>"" then
    response.write fieldValue
    else
    response.write server.HTMLEncode(lastValue)
    end if%>" style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid;"
    title="<%=fieldTitle%>" maxlength="<%=maxLength%>">
    <%
    case "textarea"
    %>
    <textarea name="<%=fieldName%>" rows="3" cols="<%=fieldSize%>" style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid;"
    title="<%=fieldTitle%>" <%=action%>><%
    if trim(fieldValue)<>"" then
    response.write fieldValue
    else
    response.write Server.HTMLEncode(trim(lastValue))
    end if
    %></textarea>
    <%
    end select
    end sub %>
    End of validateform.asp
    and I use it like this:
    <!--#include file="includes/validateForm.asp" -->
    <%
         on error resume next
    %>
    <body leftmargin="0" rightmargin="0" topmargin="0">
    <%
         validateForm "addcustomer.asp"
    %>
         <form action="" method="post" name="form1" >
    <%validateError%>
    Customer Name
    <%textbox "Name", pName, 30, "textbox", "Customer Name", 50, ""%>
    <%validate "Name", "required"%>
    the last two scriptlets create a Name field which is required. If user does not fill it an error message appears against it.
    Can someone help me please.
    Sajid

    Wow... some ASP code... its strange to see ASP these days as its been ages since i have coded in ASP.
    Well to answer your question, there are couple of options to overcome this issue.
    1) Make use of Struts Framework. It automatically takes care for the error handling(ok not automatically), but error handling of the type you are looking for is built into it and one needs to modify according to his/her own application.
    2) The other option will be to submit the data to the servlet. Populate the data into the respective fields of a Bean and put the bean into session/request as per ur requirements. On the JSP page, check if there is some data in the bean. If yes, then populate the values of HTML controls from the BEAN and the one that is empty/has custom error that you might enter in servlet can be displayed as an error message to the user.
    Hopefully this works for you. Give it a shot and its correctly said, that "necessity is the mother of invention"

  • Regarding Strtuts validation.xml

    Hi,
    I want to validate name filed.i won't accept special character.but it will accept whitespace.(now it's not accepting whitespace)
    the following things i mentioned in Valitaiotn.xml
    <form name="backgroundQuestionForm">
    <field property="name" depends="required,mask">
    <msg name="required" key="errors.invalid"/>
         <arg key="bgQuestiongroup.name"/>
         <var>
    <var-name>mask</var-name>
    <var-value>^[0-9a-zA-Z]*$</var-value>
    </var>
    </field>
    </form>
    I have to know how to mentioned whitespace in mask
    for eg: in name field 'john jayaraj' .here whitepace is there in b/w john and jayaraj.
    Plz help me in this regards,
    Regards,
    John Jayaraj,
    Mobile:+91 9865315105

    Hi,
    try this - update your target msg xsd in your XI folder........rerun your scenario and see if this error is still there..........
    if this error remains same, then in IR in data type, remove your pattern and just keep dateTime as datatype.......again update your xsd in XI folder.........rerun your scenario.
    Regards,
    Rajeev Gupta

  • ValidateXML does not work with Pick Activity?

    Hi All,
    I have a BPEL process which receives message using a pick activity, my requirement is to Validate the input message against the XSD.
    For this, i tried using the ValidateXML (bpelx:validate variables="varName") and then catch this exception using "invalidVariables" exception.
    But i am getting the below error:
    <part name="summary">
    <summary>
    Invalid xml document.
    According to the xml schemas, the xml document is invalid. The reason is: Error::cvc-elt.1: Cannot find the declaration of element 'payload'.
    Please make sure that the xml document is valid against your schemas.
    </summary>
    My WSDL message and portType is given below:
    <message name="ValidateXMLPOCRequestMessage">
    <part name="payload" element="ns2:ValidateXMLRequest"/>
    </message>
    <message name="ValidateXMLPOCResponseMessage">
    <part name="payload" element="ns2:ValidateXMLResponse"/>
    </message>
    <portType name="ValidateXMLPOC">
    <operation name="createOp">
    <input message="tns:ValidateXMLPOCRequestMessage"/>
    <output message="tns:ValidateXMLPOCResponseMessage"/>
    </operation>
    <operation name="updateOp">
    <input message="tns:ValidateXMLPOCRequestMessage"/>
    <output message="tns:ValidateXMLPOCResponseMessage"/>
    </operation>
    <operation name="cancelOp">
    <input message="tns:ValidateXMLPOCRequestMessage"/>
    <output message="tns:ValidateXMLPOCResponseMessage"/>
    </operation>
    </portType>
    Also, the same seems to be working using a standard Synchronous BPEL process. (i.e ValidateXML on the XSD)
    Any help regarding this is much appreciated.
    Regards,
    Shreyas

    Hi All,
    To update on this thread...
    The issue has been resolved, looks like ValidateXML was not working directly on the MessageType variable in bpel and hence was throwing that error.
    Solution: 1) Create a variable of type 'Element' based on the XSD
    2) Then transform the onMessage variable from the pick activity to the newly created variable.
    3) Validate this Element type variable using the "bpelx:validate name="someName" variables="newlyCreatedElementTypeVar"
    4) You can catch this exception thrown using the "invalidVariables" exception, in the catch block.
    Regards,
    Shreyas

  • OIM - Request DataSet Validation - Fetch Unchanged Attributes

    Hi ,
    I have written a request Dataset Validatior . I am able to get the values of attribute that's updated by the user .
    For example , If the user Changes the Middle Name alone , i get middle name in the code , but I need some sample code which can give me all the attribute values in the template.
    any samples much appreciated.
    Cheers
    Eash

    public class GenericRequestValidator implements RequestDataValidator {
      public void validate(RequestData reqData) throws InvalidRequestDataException{
             List<Beneficiary> beneficiaries = null;    
      List<RequestBeneficiaryEntity> benEntities = null; 
             List<RequestBeneficiaryEntityAttribute> benAttrs = null;
            beneficiaries = reqData.getBeneficiaries();
      if (beneficiaries != null && !beneficiaries.isEmpty()){
                     for (Beneficiary beneficiary : beneficiaries){
                benEntities = beneficiary.getTargetEntities();
                        if (benEntities != null && benEntities.size() > 0){
      for (RequestBeneficiaryEntity benEntity : benEntities) {
      benAttrs = benEntity.getEntityData();
      if (benAttrs != null && benAttrs.size() > 0){
                           for (RequestBeneficiaryEntityAttribute benAttr : benAttrs){
       if(benAttr.hasChild()){
      List <RequestBeneficiaryEntityAttribute> list = benAttr.getChildAttributes();
                              Iterator iterator = list.iterator();
                                       while(iterator.hasNext()){
                              RequestBeneficiaryEntityAttribute attribute =(RequestBeneficiaryEntityAttribute)iterator.next();
         // all the vallues u can use here
                                System.out.println("GenericRequestValidator.validate() Name "+attribute.getName());
                                System.out.println("GenericRequestValidator.validate()) Value "+attribute.getValue());

  • Flex Regex Help

    Hi there,
    I have a regular expression that is used to validate names in my application. It's intended to only allow alphanumeric names and spaces. My trouble started when I tried to modify it to also accept other unicode characters (umlauts and whatnot) On the java side of my app the following regex works great:
    "^(\\p{L}+\\p{M}*|\\d+)+\\s*((\\s+\\p{L}+\\p{M}*)*|(\\s+\\d+))*$"
    But due to, I'm guessing, lack of support for \p in AS3's regex engine this doesn't work. Does anyone know how to modify this regular expression to allow flex to recognize valid unicode characters?
    Here's one that I also thought would work but didn't maybe this will be helpful as a starting point.
    "^(\\w+|\\d+|[\\x00-\\x80]+)+\\s*((\\s+\\w+)*|(\\s+\\d+)|(\\s+[\\x00-\\x80]+)*)*$"
    Thanks in advance for any help.

    http://examples.adobe.com/flex3/componentexplorer/explorer.html
    http://examples.adobe.com/flex3/consulting/styleexplorer/Flex3StyleExplorer.html#

  • Java url POST request

    Hello!
    I need to access some information on a website but it requires login. I made some code but it doesn't work. The website is "www.sapo.pt" but the page source doesn't show the html form, so I have to use "http://pkgadmin.sapo.pt/xmlstyler.asp?post_action=%2Fcgi%2Fpkgadmin2-pca%2Fpca%2FLogin.tea&parOrg=SAPOADSL"
    The html form is:
    <form action="content.htm" method="post">
    <table cellspacing="0" cellpadding="0" width="576" height="150" border="0" align="center">
    <tr>
    <td valign="top" width="320" class="mosaico_login">
    <table cellspacing="0" cellpadding="0" border="0">
    <tr>
    <td valign="top">
    <div style="height:10px"><img alt="" src="newlayout2/images/shim.gif" width="1" height="10" hspace="0"></div>
    <div class="mosaico_title">username</div>
    <div><input type="hidden" name="n322" value="526"><input name="IteaComponent129523" type="text" class="mosaico" style="width:150px;" size="20" maxlength="40" id="IteaComponent2"></div>
    <div style="height:4px"><img alt="" src="newlayout2/images/shim.gif" width="1" height="4" hspace="0"></div>
    <div class="mosaico_title">password</div>
    <div><input name="IteaComponent129524" type="password" class="mosaico" style="width:150px;" size="20" maxlength="40"></div>
    <div style="height:4px"><img alt="" src="newlayout2/images/shim.gif" width="1" height="4" hspace="0"></div>
    <div align="right">
    <table>
    <tr><!--Actions de um Form--><Input type="hidden" name="post_action" value="/cli/pkgadmin2-pca/public/Action.tea"><!--Hidden Parameters--><Input type="hidden" name="parIteaActionId" value="1341135264-1"><Input type="hidden" name="parITeaFormName" value="IteaForm129522"><td><input onmouseover="MM_swapImage('validate','','NewLayout2/images/bt_entrar_on.gif',1)" onmouseout="MM_swapImgRestore()" type="image" height="35" width="28" src="NewLayout2/images/bt_entrar_off.gif" align="right" border="0" id="validate" name="validate"></td>and this is the code I made:
              String inputNameUser;
              String inputNamePass;
              String inputLine = "";
              StringBuffer dummyLine = new StringBuffer(1024);
              int pos, firstpos = 0;
              try {
                   URL ispPage = new URL("http://pkgadmin.sapo.pt/xmlstyler.asp?post_action=%2Fcgi%2Fpkgadmin2-pca%2Fpca%2FLogin.tea&parOrg=SAPOADSL");
                   URLConnection ispPageConnection = ispPage.openConnection();
                   BufferedReader in = new BufferedReader(new InputStreamReader(ispPageConnection.getInputStream()));
                           //this while block is because names, for the user and password field on the input tags, changes
                   while((inputLine = in.readLine())!=null)
                        if((pos = inputLine.indexOf("IteaComponent"))>-1)
                             firstpos = pos;
                             if((pos = inputLine.indexOf("type", pos+1)) >-1)
                                  dummyLine.append(inputLine.substring(firstpos, pos-2));
                   int len = dummyLine.length();
                   inputNameUser = dummyLine.substring(0, len/2);
                   inputNamePass = dummyLine.substring(len/2, len);
                   URL ispLogin = new URL(ispPage, "/content.htm");
                   HttpURLConnection ispConnection = (HttpURLConnection)ispLogin.openConnection();
                   ispConnection.setDoOutput(true);
                   ispConnection.setDoInput(true);
                   ispConnection.setUseCaches (false);
                   ispConnection.setRequestMethod("POST");
                   ispConnection.setRequestProperty("Content-type", "application/x-www-form-urlencoded");
                   //ispConnection.setRequestProperty("Connection", "Keep-Alive");
                   //ispConnection.setRequestProperty("Keep-Alive", "header");
                   DataOutputStream outDataForm = new DataOutputStream(ispConnection.getOutputStream());
                   String user = URLEncoder.encode("something@sapo", "UTF-8");
                   String password = URLEncoder.encode("999999", "UTF-8");
                   String content = inputNameUser+"=" + user +"&"+inputNamePass+"=" + password;
                   System.out.println(content);
                   outDataForm.writeBytes(content);
                   outDataForm.flush();
                   System.out.println(ispConnection.getResponseCode());
                   outDataForm.close();
                   BufferedReader inData = new BufferedReader(new InputStreamReader(ispConnection.getInputStream()));
                   while((inputLine = inData.readLine()) != null)
                        System.out.println(inputLine);
                   inData.close();
              catch(MalformedURLException e){}
              catch(IOException ioe){System.out.println("Error");}
               the result prints 404 for the response code, and nothing is printed on the inData stream. this stream seems to cause an IOException.
    Any kind of help will be appreciated.
    Thanks in advance.
    P.S sorry for the bad english

    Crosspost!
    http://forum.java.sun.com/thread.jspa?messageID=10095495

  • Imutable Objects

    Hi
    Im writing a class that may be used in a multithreaded environment.
    to ensure thread safety, i planned on making my object imutable. i have posted an example of what my class looks like (IRL, the actual class stores an address, but i have just gone for something simple here, in theory it should function the same)
    public class ImutableObject {
        private final int index;
        private final int value;
        public ImutableObject(int value, int name) {
            this.value = validate(value);
            this.index = validate(name);
        private int validate(int input) {
            try {
                if (input > 0) return input;
                else return -1;
            } catch (NullPointerException e) {
                return -1;
        public int getValue() {
            return value;
        public int getIndex() {
            return index;
    }my two questions are:
    1) does this still technically qualify as an imutable object given that the fields can be potentially modified by the validate() method before being written
    2) following on from 1, will this class still be thread safe? is it necessary to sychronize the validate() method to ensure it is?
    thanks!

    also, is this what you meant by using a factory method?
    public class ImmutableObject {
        private final int index;
        private final int value;
        private ImmutableObject(int index, int value) {
            this.index = index;
            this.value = value;
        private static int validate(int input) throws Exception {
            try {
                if (input > 0) return input;
            } catch (NullPointerException e) {
                throw new Exception("Cannot use null value");
            throw new Exception("Cannot use negative value");
        public static ImmutableObject createObject(int ix, int val) {
            try {
                validate(ix);
                validate(val);
            } catch (Exception e) {
                return null;
            return new ImmutableObject(ix, val);
        public int getValue() {
            return value;
        public int getIndex() {
            return index;
    }and of course the object is now instantiated by something like:
    ImmutableObject io = new ImmutableObject.createObject(0, 10);

  • Form not sent

    I have this if statement in a form
    <cfif #URL.Type# IS "Edit">
    <input type="button" value="Edit message"
    onClick="validate()" name="Edit">
    <cfelseif #URL.Type# IS "Delete">
    <input type="submit" value="Delete message"
    name="Delete">
    </cfif>
    where validate() is a javascript function that submits the
    form.
    <script type="text/javascript">
    function validate(){
    document.form.submit();
    </script>
    however, this is not working, i used a submit type button
    instead of the validate function and it worked, but i need the
    submission to be done in the javascript function and not as a
    submit button.
    any help??
    thanks in advance.

    Any one of these should work:
    <script type="text/javascript">
    function validate() {
    document.test_form.submit();
    // document.forms[0].submit();
    // document.forms["test_form"].submit();
    // document.getElementById("testForm").submit();
    </script>
    <form name="test_form" id="testForm"
    action="actionPage.cfm" method="post">
    <input type="button" value="Edit message"
    onClick="validate();" name="Edit">
    </form>

  • Help with mail form...

    Can someone please tell me why when I submit this form it gets stuck on the "sending" frame instead of advancing to the "acknowledge" frame as it should?  The code is found near the bottom...."if(this.sent == OK)" blah blah blah....  Been trying for hours now and im sure its something simple...
    stop();
    //create an array
    var favarr:Array = new Array();
    //populate the combo box using the array budget box
    favarr.push({data:"", label: "select one"});
    favarr.push({data: "0 - $250", label:"0 - $250"});
    favarr.push({data: "$250 - $500", label:"$250 - $500"});
    favarr.push({data: "$500 - $1000", label:"$500 - $1000"});
    favarr.push({data: "$1000+", label:"$1000+"});
    // end budget box
    // services box start
    //create an array
    var favarr1:Array = new Array();
    //populate the combo box using the array
    favarr1.push({data:"", label: "select one"});
    favarr1.push({data: "Basic Website", label:"Basic Website"});
    favarr1.push({data: "Dynamic Site (Flash)", label:"Dynamic Site (Flash)"});
    favarr1.push({data: "eCommerce Site", label:"eCommerce Site"});
    favarr1.push({data: "Site Redesign", label:"Site Redesign"});
    favarr1.push({data: "Site Upgrade / Update", label:"Site Upgrade / Update"});
    favarr1.push({data: "Graphic / Logo Design", label:"Graphic / Logo Design"});
    favarr1.push({data: "Business Card Design", label:"Business Card Design"});
    favarr1.push({data: "Other", label:"Other"});
    services.dataProvider = favarr1;
    services.setSize(150, 20);
    // end services box
    budget.dataProvider = favarr;
    budget.setSize(150, 20);
    //create the form validation function
    function checkform():Boolean {
        var missing:Boolean = false;
        //validate name
        if(fname.text == "") {
            errortxt1.text = "Enter a name";
            missing = true;
        else {
            errortxt1.text="";
        //validate email
        if(address.text.indexOf("@") == -1) {
            errortxt2.text = "Enter an email";
            missing = true;
        else {
            errortxt2.text=""
        //validate details
        if(details.text == "") {
            errortxt3.text = "Enter details";
            missing = true;
        else {
            errortxt1.text="";
        //if missing is true return false
        return missing ? false : true
    //create function that sends data
    function submitdata():Void {
        var formok:Boolean = checkform();
        var message:LoadVars = new LoadVars();
        var messageget:LoadVars = new LoadVars();
        var urlpath:String;
        if(formok) {
            message.fname = fname.text; //transfer variables to php this now results in $_POST['fname'];
            message.address = address.text; //transfer variables to php this now results in $_POST['address'];
            message.timeframe = timeframe.text; //transfer variables to php this now results in $_POST['timeframe'];
            message.budget = budget.selectedItem.data; //transfer variables to php this now results in $_POST['budget'];           
            message.services = services.selectedItem.data; //transfer variables to php this now results in $_POST['services'];
            message.detailsbox = detailsbox.text; //transfer variables to php this now results in $_POST['details'];
            message.sendAndLoad("mailscript.php?ck=" + new Date().getTime(), messageget); // send php code and send result back to flash. The ?ck=... bit is to ensure that the server does not send old data back instead of new data it is a cache killer parameter (ck) 
            gotoAndStop('sending');
            messageget.onLoad = function() {
                if(this.sent == OK) {
                gotoAndStop('acknowledge');
                else {
                    if(this.sent == failed) {
                        gotoAndStop('failure');
                        failuretxt.text = this.reason;
    backbtn.onPress = function():Void {
        gotoAndStop('theform');   
    submitbtn.onPress = function():Void {
        submitdata();  

    Unless OK is some variable that is defined somewhere that you aren't showing, it is otherwise a String and needs to be quoted...
    messageget.onLoad = function() {
                if(this.sent == "OK") {
                gotoAndStop('acknowledge');
                else {
                    if(this.sent == failed) {
                        gotoAndStop('failure');
                        failuretxt.text = this.reason;
    If that doesn't solve matters, try tracing the value of this.sent ahead of that if test... trace(this.sent);

Maybe you are looking for

  • Safari loads and quits after an error message

    The error message says that safari had not quit properly.

  • SAP R/3 4.0 - SAP BW 3.5 - Communication

    Hello Experts!!! In my current project, the client has a requirement where they need to integrate R/3 version 4.0 with BW 3.5. We need to find out if there are notes to be applied and what are the other challenges that we will face. Then we will send

  • Just a simple problem.

    I noticed in the tutorial that when the teacher was creating a walk cycle for the sad potato, the key frame he set at the end would remain the same once he made a keyframe in the middle. This is not the case for me. When I set a keyframe at the end,

  • Is SQL Server 2008 Express suitable?

    Hi friends, Is the Microsoft SQL Server 2008 Express version suitable and compatible with SAP Business One 8.81 or future versions? Thank you in advance. Best Regards, Kanu Pathak

  • HD movies from iTunes

    Hi.. i have my mac mini hooked to trough a dvi to hdmi cable to my tv.. can i playback movies form iTunes in HiDef ? as the text say " available on appleTV in HD! Thanks J..