Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Struts submitting corect user and passowrd, it again comes on login.jsp
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Vijay
submitting corect user and passowrd, it again comes on login.jsp
1 Answer(s)      4 years and 8 months ago
Posted in : Struts


i am submit username and password in login.jsp, after submit correct username and password, it again come in login.jsp.

Here some files:

Struts.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>

<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="false" />

<include file="mypackage.xml"/>

<!-- Add packages here -->

</struts>

mypackage.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>

<package name="mypackage" namespace="/" extends="tiles-default">

<action name="Login" class="com.struts2.LoginAction">
<result name="input">/login.jsp</result>
<result name="success">/Home.jsp</result>
<result name="error">/login.jsp</result>
</action>

<action name="customer" class="com.struts2.CustomerAction">
<result name="success" type="tiles">/logged.success.tiles</result>

<result name="input" type="tiles">/index.tiles</result>
</action>

</package>
</struts>

LoginAction.java:
package com.struts2;
import java.sql.*;
import com.opensymphony.xwork2.ActionSupport;
public class LoginAction extends ActionSupport{

private static final long serialVersionUID = 1L;

public String execute() throws Exception {

if (this.username_txt.equals("vijaykumar")
&& this.password_txt.equals("vijaykumar")) {
System.out.println("now going for success********************");
return "success";
} else {
System.out.println("here for error------------------");
addActionError(getText("error.login"));
return "error";
}
}
private String username_txt;
private String password_txt;
public String getPassword_txt() {
return password_txt;
}
public void setPassword_txt(String password_txt) {
this.password_txt = password_txt;
}
public String getUsername_txt() {
return username_txt;
}
public void setUsername_txt(String username_txt) {
this.username_txt = username_txt;
}
}

login.jsp:
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>Login page</title>
</head>

<body>
<s:form action="Login">
<s:textfield key="username_txt"/>
<s:password key="password_txt" />
<s:submit/>
</s:form>
</body>
</html>

please suggest.
thanks.

Advertisement
View Answers

May 6, 2010 at 4:44 PM


Hi Friend,

Please visit the following link:

http://www.roseindia.net/struts/struts2/struts2login.shtml

Hope that it will be helpful for you.
Thanks


Related Tutorials/Questions & Answers:
submitting corect user and passowrd, it again comes on login.jsp - Struts
submitting corect user and passowrd, it again comes on login.jsp  i am submit username and password in login.jsp, after submit correct username and password, it again come in login.jsp. Here some files: Struts.xml
regarding login.jsp code - Java Beginners
regarding login.jsp code  i tried to implement the login.jsp code example given in roseindia.net. but it is saying invalid loginbean. after compilation. can any pls send me the correct code that implements the login with jsp
Advertisements
jsp page submitting
jsp page submitting  whenever i am submitting the jsp page it downloads some unknown file on tomcat server
STACK - WHY THE OUTPUT COMES LIKE THIS?
STACK - WHY THE OUTPUT COMES LIKE THIS?  //: holding/StackTest.java import net.mindview.util.*; public class StackTest { public static void main... has dog My WHY THE OUTPUT COMES LIKE
There and Back Again
There and Back Again       The weblog of Joshua Eichorn, AJAX, PHP and Open Source Read full Description
Submitting Web site to search engine
; Before submitting your web site to search please go through... manually or use professional paid services for submitting your site
How to prevent the page refresh while submitting the form??
How to prevent the page refresh while submitting the form??  Hi. Requirement: There are two drop down boxes.Dropdown2 should load corresponding to the select of Dropdown1. Im hitting a db for this every time.Hence the page loads
Not Submitting Data - Design concepts & design patterns
Not Submitting Data  Hello Deepak , Thanks for replying me....but m not understanding ur code my problems is on designing web site.I am designing a website and in that there is one feedback form when we submit a form
again java - Java Beginners
again java  i will ask iam using servlets ,in one program my requirement is if there is a image(if u like) in anywhere and we browse that image... to the user UPLOAD THE FILE   Choose the file To Upload:  
again java - Java Beginners
again java  Hi, i will ask iam using servlets ,in one program my requirement is if there is a image(if u like) in anywhere and we browse... to the user UPLOAD THE FILE   Choose the file To Upload
how to genrate login id and password after submitting the sign up form?
how to genrate login id and password after submitting the sign up form?  i m working on a online voting project in that i have a user sign up form so i want 2 knw that after user submit all the details i that sign up form than
again with xml - XML
again with xml  hi all i am a beginner in xml so pls give me the details regarding the methods used in it. wat will return the methods getElementsByTagName(), getChildNodes(), getParentNode(), nextSibling(),etc and when
java again - Date Calendar
java again  I can't combine your source code yesterday, can you help me again. My problem is how we get result jtextfield2 from if jtexfield1 we enter(jTextfield keypressed) then the result out to jTextfield2, This my jFrame
Problem submitting a struts form containing a dojo script - Struts
Problem submitting a struts form containing a dojo script  Hello there, Is there any way to make use of dojo with struts 1 ? Actually, I'm facing a problem submitting a struts form containing a dojo script for a dynamic
escaping user input in php
escaping user input in php  Is it possible to escape the user input while submitting data into database in PHP
matching database again - Java Beginners
matching database again  Dear experts, So happy I get through this ask a question page again. Thank God. I want to say "A BIG THANK YOU" for helping me about the matching codes. It is working now after fine tuning
Read data again - Java Beginners
Read data again  sir, i still hav a problem,first your code will be change like this : in netbeans out message error 5. Can you help me again. My database like my question before.Can you fix and find the problem in my code
Read data again - Java Beginners
Read data again  Hey, i want to ask again about how to read data from txt, My DB: kd_div varchar(15), nm_div varchar(30), dep varchar(25), jab varchar(35), cab varchar(15), ket varchar(30) My data in txt file is://i
doesnt run again - Java Beginners
the soltion   Hi I am sending u again the code, this code run in my
Hi..Again Doubt .. - Java Beginners
Hi..Again Doubt ..  Thank u for ur Very Good Response...Really great.. i have completed that.. If i click the RadioButton,,ActionListenr should get call. It should add to the MS Acess table..Plz check this out.... hope u ill
Hi .Again me.. - Java Beginners
Hi .Again me..  Hi Friend...... can u pls send me some code on JPanel.. JPanel shoul have 1pic 1RadioButton .. Like a Voter List... REsponse me..  Hi friend, import java.io.*; import java.awt.
if there is an invalid entry in html:file control then form is not submitting. - Struts
if there is an invalid entry in html:file control then form is not submitting.  Hi, I have used html:file to upload the files. this is working fine in all the cases expect one usecase. 1) click on browse button and select
User Module
User Module The user first need to make registration on the website... the java language test paper. After submitting the test paper he views the result. User does the following task Login to the application Selects
Drop Down Reloads again in IE..How to prevent this?
Drop Down Reloads again in IE..How to prevent this?  Hi i was using two drop down box..One for Displaying date followed by another for Dispalying Month..If i Select/Change Month from the 2nd drop down then the 1st drop down
help again plz sorry - Java Beginners
help again plz sorry  Thanks for giving me thread code but i have a question this code is comletelly right and i want to make it runs much faster for that i made 5 threads but 2 things i dont understand 1- with one
Plz chk it and reply again - Java Beginners
Plz chk it and reply again  Hi Deepak, Thanks for fast reply,your application is good,u write this code for user click the view database.... But I want user input in name textbox like that a then click search all
user validation
user validation  i hv just started with my lessons in jsp n also doin...(); } } /* if(userName.equals(request.getParameter("user")) &amp;&...("")) { out.println("&lt;a href="login.jsp"&gt;&lt;b&gt;Login &lt
After Logout Back Button Should not work again
be creating session and adding some attribute during login process of user. Please
How to display data fom MySQL DataBase-table in to JSP file by submitting a value in combobox.
How to display data fom MySQL DataBase-table in to JSP file by submitting a value in combobox.   I have the same problem.plz help me. I have MySQL DataBase/DB Name:lokesh; Table Name:TR_list; columns:nodename,packageno,TR
Script on the page used too much memory. Reload to enable script again.
Script on the page used too much memory. Reload to enable script again. ... to enable script again". After getting this error other pages also not working. Logout and login again not working. if open the new tab then only working other
user in mysql
user in mysql  how to create user in mysql?   Please visit the following link: http://www.roseindia.net/mysql/mysql5/mysql-creating-account.shtml
 

 

 

DMCA.com