JSP-VALIDATION

Pls, I want to do validation with jsp. I want it to return error messages that some data are omitted on the same page with the form submitting, but its not working. pls, assist!. See the code
<html>
<body>
<% String first = request.geParameter(firstname);
    if(first !=null || !first.equals(""))
       // go to another page         
    else
       %>
Fill in your first name
<form method="post action="accept.jsp">
First Name: <input type="text" name="firstname"> <%=first%>
<input type="submit" value="Submit">
<%}%>
</body>
</html>

spelling mistake "getparameter"

Similar Messages

  • Seeking help on JSP Validator

    hi,
    I want to write a jsp validator which will detect syntax
    errors in a JSP Page so that it can be validated before
    deploying it in a Web Server.I have no clue as how to do it.
    Please guide me in this regard.
    Thanks and Regards,
    Indranilr

    Save yourself a lot of time and get an ide that does this for you. Eclipse is free and I think it has this feature (WSAD definitely does)

  • JSP Validation failed

    Hi,
    I am working on WSAD environment. In the package explorer view, in one of the projects, error symbol is there. It says "JSP Validation Failed". I was not sure if this is effecting my project execution in any way. But I was wondering what does it mean by "JSP Validation Failed".
    Thanks

    In the task Lists , this error will be displayed,
    Double click on that and it will give the details of that.
    Yes it can create problems later, better fix it when you see it ..
    Try rebuliding the project , that might fix the problem sometimes

  • Prevent jsp validation rules from view source

    is there any way to prevent jsp or js validation script,from html view source (other than using struts validation framework).

    is there any way to prevent jsp or js validation
    script,from html view source (other than using struts
    validation framework).JS files get downloaded in the browser temp directory so there's no way of preventing a user from not accessing it.
    ***Annie***

  • JSP validation warning.

    empty

    Does this happen in the course of just modifying JSPs and resource files, or
    when a resource file is added or refactored?
    It would be great if you can provide us with the steps you follow to
    experience this problem.
    M7 Support
    PS: Sending requests to [email protected] usually has faster response time.
    "DanBar" <[email protected]> wrote in message news:[email protected]..
    DanBar wrote:There' a bug(?) causing Nitrox (build225) to report warnings like that:
    I've tried build 226 - nothing's changed.
    DanBar

  • NoClassDefFoundError while validating JSP

    Hello, I am using the trial version of NitroX for Struts with Eclipse 3.0.2. Everything seemed to be OK for the first 5 days or so, but now, every time I do a build, I get this warning in the "Problems" tab of the Web Perspective:
    Run-time exception java.lang.NoClassDefFoundError occurred during validation. The validator being run was JSP Validator and the message thrown was com/genuitec/eclipse/core/util/Util. I get one of these messages for every JSP in my project, regardless of simplicity. Thank you in advance any help/advice you can give.

    Hi,
    What are the different plug-ins configured for your eclipse?
    Send the following log files to [email protected]
    * ..eclipse\workspace\.metadata - .log file
    * <NitroX Install Folder>\NitroX\eclipse\plugins\com.m7.nitrox_2.0.0 - m7.log.0 file
    M7 Support

  • StrutsTags/JSP or... Another Nesting Newbie

    I am having trouble teaching myself Struts taglib syntax/JSP coding and I am stuck on a classic nested object JSP/Struts syntax problem...
    Can you explain the errors in the following snippet?
    Background: The form associated with the jsp contains a property called "electronicDocDetails" which is an ArrayList of "DisplayFieldList" objects. DisplayFieldList objects have a list of "DisplayField" objects that have displayNames and values, etc..
    The Jsp validation results in the error "Jsp Translate: The Attribute value has no value"
    Also, I've tried writing this using only 'logic' and 'bean' tags instead of using nesting and I get the same error. (Yes, I've read two Struts books and the Apache Struts website documentation :-( ).
    <BODY>
    <html:form action="/CaseInquiryDetails">
    <nested:iterate property="electronicDocDetails" >
         <TR align="center">
    <TD align="center" colspan="4" class="MssTDFormLabel">
                        <bean:message key="label.caseinquirydetails.electronicdoc"/></TD>
         </TR>
              <nested:iterate property="fieldList" >
              <TR align="center">
                   <TD align="left" class="MssTDFormLabel" colspan="1">
                        <nested:write property="displayName" />
                   </TD>
                   <nested:equal property="displayName" value="NAME" >
                        <TD align="left" class="MssTDFormLabel" colspan="3">
    <%-- ERROR ON THE FOLLOWING LINE with the first '<bean:write>' --%>     
    <%-- "Jsp Translate: The Attribute value has no value" --%>
    <html:link href="<%=prefix%><bean:write property="value" />">
                        <bean:write property="value" />
    </html:link>
                        </TD>
                   </nested:equal>
                   <nested:notEqual property="displayName" value="Name" >                                   
                        <TD align="left" class="MssTDFormResult" colspan="3">
                             <bean:write property="value" />
                        </TD>
                   </nested:notEqual>
              </TR>
              </nested:iterate>
         </nested:iterate>
    TIA...
    jrh

    The "nested" tags are for use in navigating bean hierarchies.
    NOT for nesting tags.
    ie you use them like this (pulling an example from the documentation: http://struts.apache.org/struts-doc-1.2.x/userGuide/struts-nested.html
    //Instead of this:
    <nested:write property="myNestedLevel.propertyOne" />
    <nested:write property="myNestedLevel.propertyTwo" />
    <nested:write property="myNestedLevel.propertyThree" />
    //You can write this:
    <nested:nest property="myNestedLevel" >
      <nested:write property="propertyOne" />
      <nested:write property="propertyTwo" />
      <nested:write property="propertyThree" />
    </nested:nest >You should just be using the regular "logic" and "bean" tags
    Your main problem is here:
    <html:link href="<%=prefix%><bean:write property="value" />">
    You can't nest custom tags as attributes to other custom tags.
    You can only use expressions.
    Try declaring a temp variable with that value like this:
    <bean:define id="tempURL"><%=prefix%><bean:write property="value" /></bean:define>
    <html:link href="<%= tempURL %>">
      <bean:write property="value" />
    </html:link>

  • Jdev 10G Custom Tag compilation problems

    Hi,
    I noticed that new tld's are added to "src/META-INF/."
    When i compile my jsp to reference the tld it is not successful b/c it is looking for the tlds within the "public_html" or somewhere within it. I turned off tld and web.xml validation, but jdev 10G still validates the location of the tld. Is there way to configure Jdev to put the tld in another location?
    I know i can work around this by building w/ ant or someother compiler external to Jdev, but would like to remedy this problem so i can use jdeveloper as it is.
    hope someone can shed some light, i've been working on this all day long...
    Thanks in advance,
    Eugene

    i am referenceing the tld via the web.xml alias entry. I found a work around where i copy the tld to somewhere in the public_html location of the project. I guess Jdeveloper doesn't look for the tld within META-INF which is embedded in the src directory structure of the project. For some reason, Jdeveloper doesn't look there for the TLD where it writes the tld to. it's interesting that jdeveloper doesn't look for the tld where it writes to. :)
    from the server side, when i deploy, it works okay. but to get around the compilation problem, i have to copy the tld or softlink it to the META-INF location of the original tld.
    I tried turning off web.xml, tld, and jsp validation of TLDs to get around this problem, but that doesn't seem to "turn it off."
    How do you approach this problem? do you use ant or some other external build process?
    thanks!

  • JSTL1.1 uri confusion

    I downloaded the Java Web Services Developer Pack 1.3 and took standard.jar and jstl.jar files from the
    jstl/lib directory and I am running Tomcat 5.0. I wanted to use JSTL 1.1 for the new EL functions support
    but I have been experiences the following two problems:
    1.) I can't use seem to use the JSTL 1.1 uri's. I have checked the TLDs in standard.jar, which seem to match:
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>Using these uri's, my jsp's are failing silently and entries such as <c:out value="${task.performRole}"/> are being rendered as:
    ${task.performRole}However, the JSTL 1.0 uri's seem to work correctly:
    <%@ taglib prefix="c" uri="http://java.sun.com//jstl/core" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com//jstl/fmt" %>2.) I cannot get the EL Functions working at all. Using:
    <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
    <c:out value="${fn:subString(task.performRole), 2}"/>I get this error:
    ServletException in:/WEB-INF/jsp/contentViewMyTasks.jsp]
    Validation error messages from TagLibraryValidator for c
    116: tag = 'out' / attribute = 'value': An error occurred while parsing custom action attribute "value"
    with value "${fn:subString(task.performRole), 2}": org.apache.taglibs.standard.lang.jstl.parser.
    ParseException: EL functions are not supported.And using:
    <%@ taglib prefix="fn" uri="http://java.sun.com/jstl/functions" %>gives me this error:
    [ServletException in:/WEB-INF/jsp/contentViewMyTasks.jsp] The absolute uri:
    http://java.sun.com/jstl/functions
    cannot be resolved in either web.xml or the jar files deployed with this applicationAny help with these problems would be greatly appreciated!

    Hi Martin3,
    I originally worked from this post to the jakata taglib mailing list:
    http://www.mail-archive.com/[email protected]/msg06306.html
    It recommended removing the DOCTYPE tag completely. It works for me and I can put the prefix before the uri in the taglib declarations like this:
    <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>However, I do not know if it is good practice to have no DOCTYPE at all in web.xml file. If you find the correct DOCTYPE declaration to use, please post it.

  • Portlet taglib

    Hi
    In Weblogic Workbench 9.2 I am using the Portlet Taglib to generate an actionURL. However, eclipse doesn't seem to recognise the declared var so is indicating that the variable (e.g. in var sTargetURL = "<%=actionUrl%>") cannot be resolved.
    <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
    <portlet:defineObjects/>
    <portlet:actionURL secure="true" var="actionUrl">
    <portlet:param name="nav_state" value="action_001"/>
    </portlet:actionURL>
    <script language="JavaScript">
    var sTargetURL = "<%=actionUrl%>";
    function doRedirect()
    setTimeout( "timedRedirect()", 2*1000 );
    function timedRedirect()
    window.location.replace( sTargetURL );
    doRedirect();
    </script>
    You are attempting to access this portlet via an insecure connection!
    <br><br>
    <p>You are being redirected to a secure server.
    <br>
    If this page does not redirect after 3 secs. Please
    click <a href="<%=actionUrl%>">here</a> to continue.
    Because the application doesn't build it cannot be deployed. Only workaround I have found is to turn JSP verification off i.e. project properties-->validation-->uncheck JSP Syntax Validator
    Does anyone know of an alternative?
    Additionally, if the browser is left to perform a timed redirect then the portlet is invoked via the render URL rather than the action URL. If the provided link is clicked then the portlet is invoked correctly via the action URL.

    This is a noted limitation in the Release Notes.
    CR273414 JSP tag variables cannot be resolved in Workshop for JSP
    Due to a problem in Eclipse, some JSP tags (such as <auth:login> and <portlet:actionURL> and variables declared from JSP tags are marked as containing an error when they are actually correct. Although no error actually exists, Eclipse will not publish (deploy) the application.
    Platform: All
    Workaround: If this situation occurs, you must turn off JSP validation before publishing. Leave JSP validation on until you have fixed any problems except those caused by these tags; before deploying, select Window > Preferences, select Validation in the tree, and uncheck the JSP Syntax Validator check box.

  • Change the calendar control's error message

    I have a number of calendar controls which are used to pick dates, however they all have the ability to key the date in and if you enter an invalid format for the date value, they raise the "Conversion Error Occurred" error which displays on screen in the message box.
    I want to replace this error with something more user friendly. I have tried adding messages to a bundle and defining the bundle in the app config, but it does not seem to work.
    Anyone got any ideas how to do this?
    ta
    b

    hi juergen
    i had a look at that but the "conversion error occurred" message for the calendar does not seem to be defined in the themes
    i think it is actually a jsp validation message, but i can't figure out how to make it change
    i will keep looking i suppose
    b

  • Regular expressions for URLs to match extensions

    I am working on a simple method that will assign a specific extension
    (e.g. ".jsp", ".php", ".cfm", etc.) to the end of a URL if it doesn't
    find anything marking a valid extension, however, I do not want to add
    an extension if one is found.
    Consider my code:
    import java.util.regex.Pattern;
    public static final String urlEndSlashPattern = "/?";
    public static final String urlQSPattern = "\\??([a-zA-Z0-9\\-_\\.]
    +=[^&]*&?)*";
    public static final String urlAnchorPattern = "#[^#]*$";
    public static void addExtToUrl(String url, String myExt, String[]
    exts) {
       StringBuffer sb = new StringBuffer();
       boolean hasExt = false;
       for (int i = 0; i < exts.length; i++) {
    sb.append(".").append(exts).append(urlEndSlashPattern).append(urlQSPatte�rn).append(urlAnchorPattern);
    if (Pattern.matches(sb.toString(), url)) {
    hasExt = true;
    sb = new StringBuffer();
    if (!hasExt) {
    url += "." + myExt;
    The issue I want to bring up is the regular expression pattern I'm
    using appears to fail.  I want to check and see if the URL I provide
    ends with a valid extension, followed by optional "/" or a query
    string or an anchor or any combination of these.
    Like say if I have
    http://www.blah.com/index.html
    Then don't add the ".jsp" extension
    But if I have
    http://www.blah.com/registration/
    Then I *want* to add the ".jsp" extension:
    http://www.blah.com/registration.jsp
    Or if I have:
    http://www.blah.com/registration/?foo=bar#baz
    Then it needs to change to
    http://www.blah.com/registration.jsp?foo=bar#baz
    But if I have
    http://www.blah.com/registration/index.php?foo=bar#baz
    Then I do *not* add the ".jsp" extension.
    Hope that makes sense now.  Bottom line is that the pattern above
    doesn't seem to work.  Ideas?
    Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Ok, just for fun, let's try it.
    URL: http://www.blah.com/?bar=baz#anchor
    Absolutely valid URL and something possible (remember, Balus, this is from a database entry, thus, it can be anything at all!)
    Let's split onto the last /
    Your last entry will be
    ?bar=baz#anchor
    So if I re-insert the .jsp that it would not find I get
    http://www.blah.com/.jsp?bar=baz#anchor
    INVALID URL
    Now let's try this one, BalusC:
    http://www.blah.com/index.jsp?forwardURL=http://www.wee.com/gotcha_balus/
    Now we split according to the ... last /
    http://www.blah.com/index.jsp?forwardURL=http://www.wee.com/gotcha_balus.jsp
    Valid URL, but possibly wrong when the query string value for "forwardURL" is read, thus, making the URL ultimately wrong.
    Two examples that show that splitting by the last / can't work here.

  • Credit Card Payment issue in Firefox

    Hi All,
    We have implemented, SAPu2019s Business package for ISA 5.0 SP14 connecting to ECC 6.0.
    And have implemented online payment options for various types of credit cards.
    The credit card data and validity gets validated via 3rd party system which authenticate the card details and the control comes back to ISA application, in this process if the card is not registered for secure code authentication then the card payments is successful, but if the card is registered for secure code (3D secure) then firefox is not able to redirect the page correctly and the screen becomes blank with no option to go forward or backward.
    When this credit card option is tried in Internet explorer, the payment is successfully for any type of card supported by our application. The screen correctly redirects to the security page and then to the 3rd party URL and at the end the control comes back to our application fine.
    We are using JSP page to perform this action. This form is hidden from the customer, the action for this form is specified as the u201Cthird party Urlu201D so that the contents of the form are posted to that URL.  The target is specifed as the name of the iFrame so that the authentication step is displayed within the iFrame.  The contents of the form are the AuthReq, a free-format merchant descriptor
    and the Term Url that the issuing bank should re-direct the customer to.  In this case the Term URL specified in another jsp valid.jsp page, which is a page that displays no content to the customer, and so displays in the iFrame as blank for a second, and then posts
    the AuthRes back to this page, when the actual index jsp then reloads and processes it.
    I would like to understand, whether there is different way to handle hidden form or ifrmaes for Internet explorer and firefox.
    Thanks in advance.

    Opened another theard in ECommerce forum hence closing this thread.

  • Please help the end tag /c:if" is unbalanced

    Mar 27, 2008 12:33:57 PM org.apache.catalina.core.ApplicationDispatcher invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    org.apache.jasper.JasperException: /WEB-INF/jsp/cwjsps/proregistration.jsp(61,0) The end tag "</c:if" is unbalanced
         at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
         at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
         at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:132)
         at org.apache.jasper.compiler.Parser.checkUnbalancedEndTag(Parser.java:1581)
         at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1450)
         at org.apache.jasper.compiler.Parser.parse(Parser.java:133)
         at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:216)
         at org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
         at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:167)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:306)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
         at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
         at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:283)
         at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:56)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:189)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
         at org.apache.catalina.core.ApplicationDispatcher.access$000(ApplicationDispatcher.java:65)
         at org.apache.catalina.core.ApplicationDispatcher$PrivilegedForward.run(ApplicationDispatcher.java:80)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:284)
         at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:694)
         at org.apache.jasper.runtime.PageContextImpl.access$1000(PageContextImpl.java:71)
         at org.apache.jasper.runtime.PageContextImpl$11.run(PageContextImpl.java:652)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:650)
         at org.apache.jsp.WEB_002dINF.jsp.cwjsps.router_jsp._jspx_meth_c_005fif_005f3(router_jsp.java:299)
         at org.apache.jsp.WEB_002dINF.jsp.cwjsps.router_jsp._jspService(router_jsp.java:103)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
         at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:283)
         at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:56)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:189)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         at org.apache.catalina.valves.RequestFilterValve.process(RequestFilterValve.java:269)
         at org.apache.catalina.valves.RemoteAddrValve.invoke(RemoteAddrValve.java:81)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
         at java.lang.Thread.run(Thread.java:619)

    boss the requirement is as such..thats why i am developing it this way..
    i am posting my debug.jsp(validation and exceptions), router.jsp(which forwards corresponding jsp pages based on success or failure), userregistration.jsp(jsp view), proregistration.jsp(process jsp )
    {code debug.jsp}
    <?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" %>
    <%-- \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>
    {code router.jsp}
    <?xml version="1.0" encoding ="iso-8859-1"?>
    <%-- /WEB-INF/jsp/cwjsps/router.jsp --%>
    <%@ 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" %>
    <%--  setup session if one does not exist --%>
    <%@ page session="true" %>
    <%-- set up debug variable --%>
    <c:set var="sessDebug" scope="session" value="true"/>
    <%-- 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/prologin.jsp"/>
    </c:if>
    <%-- uc01 : View Details Of Books For Sale --%>
    <c:if test="${pageScope.pgePathInfo =='/viewbooksforsale'}" >
    <jsp:forward page="/WEB-INF/jsp/cwjsps/probooksforsale.jsp"/>
    </c:if>
    <%-- uc01 : process User registration--%>
    <c:if test="${pageScope.pgePathInfo =='/userregistration'}" >
    <jsp:forward page="/WEB-INF/jsp/cwjsps/proregistration.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"/>{code userregistration.jsp}
    <?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">
    <html>
    <head>
    <title>Registeres USers Login Page</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <body>
    <%--debugging code--%>
    <%@ include file="debug.jsp" %>
    <table width="1049" cellpadding="5" align="center">
    <tr>
    <td width="2378"><div align="center">
    <h2 align="center"> User Registration</h2>
    <p>
         <c:url var="HmePgeURL" value="/cw/router/home" scope="page"/>
         Home  <c:url var='BSPgeURL' value='/cw/router/login' scope='page'/>
         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>
    <c:url value="/cw/router/userregistration" var="UregPgeURL" scope="page"/>
    <form name=frmregister method="post" action="${UregPgeURL}" >
    <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>
    <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>
    </div>     
    </form>
    </body>
    </html>
    {code proregistration.jsp}
    <?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" %>
    <%-- \WEB-INF\jsp\cwjsps\probooksforsale.jsp --%>
    <%-- Probookforsale --%>
    <%-- skip field validation and provide blankpage if first time in --%>
    <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>
    <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>
    <%-- 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>
    <c:catch var="pgeQueryError">
    <sql:update var="pgeRowCount" scope="page" >
    <%-- insert details to trader table --%>
    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:param value="${param.txtdob}"/>
    <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 duplicate record --%>
    <c:when test="${pgeQueryError.rootCause.errorCode =='1062'}">
    <c:set var="reqQueryErrorMessage" scope="request" value="User already Registered - Duplicate Record" />
    <jsp:forward page="/WEB-INF/jsp/cwjsps/login.jsp"/>
    </c:when>
    <c:otherwise>
    <%-- database error --%>
    <c:set var="reqQueryErrorMessage" scope="request" value="Database Error" />
    <jsp:forward page="/WEB-INF/jsp/cwjsps/userregistration.jsp"/>
    </c:otherwise>
    </c:choose>
    <c:set var="reqOutcome" scope="request" value="failure" />
    <jsp:forward page="/WEB-INF/jsp/cwjsps/userregistration.jsp"/>
    </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:if test="${pgeRowCount ==1}">
    <c:set var="reqOutcome" scope="request" value="success" />
    <jsp:forward page="/WEB-INF/jsp/cwjsps/login.jsp"/> <%-- success --%>
    </c:if>

  • Faces-config redirect issue

    Hi,
    My JSF application needs to be populated with some values on the load of the page. Essentially these values need to be fecthed only on first logon.
    So in order to avoid going to database on page load all the time, I wrote onload action in index.jsp. I return a string success/failure from that action which should forward control from index.jsp to either search.jsp/error.jsp.
    This is how I hv declared it in my faces-config.xml:
    <navigation-rule>
    <from-view-id>/index.jsp</from-view-id>
    <navigation-case>
    <from-outcome>success</from-outcome>
    <to-view-id>/search.jsp</to-view-id>
    <redirect/>
    </navigation-case>
    </navigation-rule>If I don't put <redirect/> here, then even though search.jsp page shows, I am not able to perform any action on it.Non of my buttons are submitted. I want to get rid of <redirect/> as I don't want browser URL to change.
    Please note that this is an ajax enabled application and I use a4j tag library fo ajax support.
    Can some please clarify on this??
    Thanks in advance!

    This probably won't help you b/c you're actually using JSF, which I am not nor have I used yet, but I was getting validation errors in Rational Application Developer 6.0.1 similarly. RAD has two validators (in addition to others) turned on by default: Faces Client Validator and Faces JSP Validator. I'm not sure, but it looks like I was getting a timeout when trying to verify a URL located in the Struts 1.2.8 validator-rules.xml file:
    http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd
    RAD would eventually spit out an error listed in the 'Problems' tab that indicated a timeout occurred--probably due to a bad connection while trying to validate. Anyway, I went into the Window menu, selected Preferences -> Validation and deselected the two validators mentioned above. After saving that change, I cleaned my workspace and rebuilt all of the projects. This time RAD didn't complain and all of the projects were rebuilt successfully.
    Hopefully this info will be of use to others.
    Jeff

Maybe you are looking for