facebook

Problems using struts-tiles and validator with myeclipse

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #258636 Reply

    mominaqeel
    Member

    Hi,
    I’m developing a Test application using Myeclpise, Struts, Tiles and trying to catch some input validation at client side using Java Script and struts-validator.
    I’m expecting a message-box to be popped up but instead it is going to an page with adding ‘do’ extension to my action and displaying error on the page, which is not having any of my tiles definitions. I’m expecting either a pop-up or error to be displayed in the same tiled page.
    Following are the parts of my application, Can anyone help me with any ideas/suggession

    
    1) struts-config.xml
    <form-beans>
        <form-bean name="userLoginFormBean" type="com.antaressolutions.struts_class.form.UserLoginFormBean" />
    </form-beans>
      <global-exceptions />
    <action-mappings>
    <action path="/userLogin" type="com.antaressolutions.struts_class.action.UserLoginAction">
          <forward name="showLogin" path="page.login" />
    </action>
    <action
          attribute="userLoginFormBean"
          input="/jsp/pages/userLogin.jsp"
          name="userLoginFormBean"
          path="/UserLoginSubmit"
          scope="session"
          type="com.antaressolutions.struts_class.action.UserLoginSubmit">
          <forward name="usersuccess" path="page.usermain" />
          <forward name="failure" path="page.login" />
    </action>
    </action-mappings>
    
    2) tiles-defs.xml
    
    <tiles-definitions>
        <!-- Base Tiles Definition -->
        <definition name="base.definition" path="/jsp/pages/siteLayout.jsp">
            <put name="header" value="/jsp/pages/header.jsp" />
            <put name="navigation" value="/navigation.do" />
            <put name="footer" value="/jsp/pages/footer.jsp" />
        </definition>
        <!-- Tiles Definition of Users Login Page -->
        <definition name="page.login" extends="base.definition">
            <put name="title" value="System Users Login" />
            <put name="body" value="/jsp/pages/userLogin.jsp" />
        </definition>
    </tiles-definitions>
    
    3) validation.xml
    <form-validation>
       <formset>
            <form name="userLoginFormBean">
                <field
                    property="uname"
                    depends="required">
                        <arg0 key="userLoginFormBean.uname"/>
                 </field>
             <field
                property="upwd"
                depends="required,mask">
                <arg0 key="userLoginFormBean.upwd"/>
                <var>
                    <var-name>mask</var-name>
                    <var-value>^[0-9a-zA-Z]*$</var-value>
                </var>
             </field>
            </form>
       </formset>
    </form-validation>
        
    4) userLogin.jsp
    
    
    <%@ page language="java" pageEncoding="UTF-8"%>
    
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
      
     
       <br>
        <div id="cntrlogin" align="center">
         <html:errors/> 
        <html:form action="/UserLoginSubmit" method="post" onsubmit="return validateuserLoginFormBean(this);">
        <B> User Login Page</B><br>
        Please enter a valid Username and Password<br><br>
         <TABLE border="2">
            <TR>
                 <TD align="right" class="data">User Name:</TD>
                 <TD align="left" class="data"><html:text property="uname" size="10" maxlength="10"/> <span class="error">*</span> </TD>
            </TR>
            <TR> 
                 <TD align="right" class="data">Password:</TD>
                 <TD align="left" class="data"><html:password property="upwd" size="10" maxlength="10"/> <span class="error">*</span> </TD>
            </TR>
            <TR> 
                 <TD align="right" class="data">System:</TD>
                 <TD align="left" class="data"><html:select property="system" ><html:option value="CPIMS" /><html:option value="CONTRACT" /></html:select></TD>
            </TR>        
            <TR>
                <TD align="right"><html:submit value="Submit" /></TD>
                <TD align="left"><html:reset/></TD>
            </TR>
        </TABLE>    
            <!-- Begin Validator Javascript Function-->
            <html:javascript formName="userLoginFormBean" />
            <!-- End of Validator Javascript Function-->
    
        </html:form>
        </div>
    
    

    Can you one please identify where I’m wrong,

    Regards
    Aqeel..

    #258668 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Problems using struts-tiles and validator with myeclipse

You must be logged in to post in the forum log in