As far as I can tell you've posted three questions asking the same thing.

The "simple" theme doesn't render error information.

Dave

sajidbigler wrote:
Hi plz help me to resolve this when we use table with in jsp validation
framework wont be applied and as well actionerror,actionmessages wont b
shown how to resolve this?


Login.jsp

<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>


<html>
<head>
<title>MMS Application</title>

<link href="<s:url value='/css/main.css'/>" rel="stylesheet"
        type="text/css" />

</head>
<body>
<div id="container"> <p class="hide">Skip to: #nav site menu | #leftside section menu | #content main content </p>

<div id="sitename">
<h1>MMS Application</h1>
Subscriptions Management System </div>



<div id="wrap1">
<div id="wrap2">

<div id="topbox"><strong> Login Page &raquo;
</strong></div>




<div id="content">
<h1>Welcome to "MMS Application "...</h1>
<h2>Enter Login Details  </h2>

        <s:form action="doLogin" method="POST" theme="simple">
                <table>
                        <tr>
                        <td align="center" colspan="2" ><s:actionerror 
/><s:actionmessage/></td>
                </tr>
                                        <tr>
                        <td align="center" colspan="2" ><s:label 
label="SignIn"/></td>
                </tr>
                <tr>
                <td><s:text name="some.key"></s:text></td>
                        <td  ><s:textfield name="username" key="some.key" 
/></td>
                </tr>
                                <tr>
                <td><s:text name="some.key"></s:text></td>
                        <td  ><s:password name="password" label="Password" 
/></td>
                </tr>
                <tr>
                <td colspan="2" ><s:submit value="Login" />
        <s:reset  /></td>
                        </tr>
        </table>
        

</s:form>
        <s:a href="pages/SignUp.jsp" cssStyle="float:right">New User 
SignUP</s:a>

</div>
</div>

<div id="footer">
<p>&copy; 2009 Teleparadigm | Powered by http://teleparadigm.com/contactus.html Teleparadigm </p>
</div>
</div>
</div>
</body>
</html>

LoginAction-validation.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd";>
                
<validators>
        <field name="username">
                <field-validator type="requiredstring">
                        true
                        <message key="some.key8">Login name is 
required</message>
                </field-validator>
        </field>
        <field name="password">
                <field-validator type="requiredstring">
                        true
                        <message>Password is required</message>
                </field-validator>
        </field>
        
</validators>

LoginAction.java

package com.teleparadigm.mms.application.login;
import java.util.Map;
import java.util.logging.LogManager;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts2.interceptor.ServletRequestAware;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.util.logging.Logger;
import com.teleparadigm.mms.application.common.Owner;



/**
 * <p> Validate a user login. </p>
 */
public  class LoginAction  extends ActionSupport  implements
ServletRequestAware
{
        

        private HttpServletRequest request;

        public void setServletRequest(HttpServletRequest request){
                this.request = request;
        }

        public HttpServletRequest getServletRequest(){
                return request;
        }

        LoginDAO ldao=new LoginDAO();
        private String username = null;
        private String password = null;
        public String execute() throws Exception {

                Owner ownerobj=ldao.getUserObject(getUsername().trim());
                String PasswordFromDB=ownerobj.getPassword();
                System.out.println("getUsername()-->"+getUsername());
                System.out.println("PasswordFromDB-->"+PasswordFromDB);
                System.out.println("getPassword()-->"+getPassword());
                if( PasswordFromDB==null ||
!(getPassword().equalsIgnoreCase(PasswordFromDB))){
                        addActionError("Invalid user name or password! Please try 
again!");
                        return ERROR;
                }else{
                        HttpSession session=request.getSession(true);
                        session.setAttribute("ownerobj", ownerobj);
                        return SUCCESS;
                }
        }

        public String getUsername() {
                return username;
        }
        public void setUsername(String username) {
                this.username = username;
        }
        public String getPassword() {
                return password;
        }
        public void setPassword(String password) {
                this.password = password;
        }





}



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to