Please help me how to check whether the username,password entered in the login page is validor exists in the database User name,Password fields

not enough actual parameters

hi jwenting,

from all ur replies u seem to be like very knowledgeble person in web application. cld u pls help me in one thing? i work in C and totally new to web development. I m strting with struts on net bean jdk. my question is...

in normal login page we have two options. one is for existing users and other one is for new users. so there should be two links. one will take u to ur inbox and other for signing up process. my question is how do we configure more than one link from a single page.

if u will give me answer rltd to struts-config.xml, then pls give me one ex. also. i wld really appreciate all ur replies.

thanks & regards,
deepak

Comments
thread hijacker

Hi depak,

in struts-config.xml file u can specify the multile link for a single page throug action tag. that multiple links can be accessed in action servlet.
For Example:
in struts-config.xml :

<action path="url"  type="actionClass" name="formBeanName">
<forward property="sucess" path="default url"/>
<forward name="likn1" path="link1 url.do"/>
<forward name="likn2" path="link2 url.do"/>
</action>

Regards
Yuvaraj.v

hi Yuvraj,

Thank u vry much for the reply, but still i didn't get the point :(

i have two buttons BUTTON A, BUTTON B on a single page. In struts config file how can i associate two different actions for a single page. In my case how will i associate different actions with BUTTON A and BUTTON B ?

For this do i need to do any change in java file (Action Class)? If yes then what type of changes? And if i need to do some other changes then please let me know.

Please bear with me for my silly questions.

Regards,
Deepak

Hi Deepak,

1) While clicking the buttons u can get the indication in action file sepearatle for button A & B by request parameter or Hidden variables
2) In Action class, u hav to mention the mapping like "return mapping.findForward("link1");" and "return mapping.findForward("link2");"
3) This link1 & link2 are mentioned already in name attribute of struts-config.xml
4) Based on this link name, Page wil be forward to the mentioned url in attribute path of action tag in struts-config.xml

for Examples : refer this site http://www.roseindia.net/struts/

The above site is worst possible place to learn from. Recommending use of old fashion methods and approaches, collecting out of date tutorials with code examples and lastly badly organized.

what'd you expect from an Indian site by homework kiddos for homework kiddos?

I usually recommend them to homework kiddos, provides a good laugh to see them trashing about ;)

Hi Jwenting,

Why don't you try to help people instead of passing comments and barking?

Regards,
Deepak

Hi Deepak,

U have raised very very helpfull question to Mr.Jwenting. Thx alot for this great question.

Regards
Yuvaraj.V

<EDIT>: Sorry guys mixed up my tabs in firefox, post was meant for "Pdu to text..." thread in Java forum

<EDIT>: Sorry guys mixed up my tabs in firefox, post was meant for "Pdu to text..." thread in Java forum

;) :D :twisted:

Hi Yuvraj,

if you don't mind, can i get ur id ?

Regards,
Deepak

Hi deepak,

sory to say this, i hav no out going mail permission to u.

regards
Yuvaraj.V

you can try with database .
please try to this code if any confusing then ask me .

String login=request.getParameter();
String pass=request.getParameter();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection();
PreparedStatement ps=con.PrepareStatement("select * from ravindra where login=?, password=?");

ps.setString(1,login);
ps.setString(1,pass);
ResultSet rs=ps.executeQuery();
if (rs.next())
{

//enter into the if statement  if login & pass is present in database.

}
else
{
otherwise this.
}
This article has been dead for over six months. Start a new discussion instead.