• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is This Posible  RSS feed

 
Abhay Ram
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Login Page</title>
<script type="text/javascript">
function check()
{
alert("chaeck");
if(document.getElementById("name").value == "Abhay" && document.getElementById("pass").value == "abhay")
{
<% out.print("Login Successfull"); %>
return true;
}
else
{
<% out.print("Login unsuccessfull"); %>
return false;
//}
}

</script>


</head>
<body>
<html:form action="loginAction" method="post" >
Name:<html:text property="name" styleId="name"></html:text>

Password:<html:password property="password" styleId="pass"></html:password>
<html:submit onclick="check();"></html:submit>
</html:form>

</body>
</html>
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to type? Yes, you proved that it is.
Welcome to the Ranch, but please TellTheDetails and UseCodeTags
It is too much work for us to work out what you're asking above.
 
Sean Clark
Rancher
Posts: 377
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried this?
Did you get any error messages?
Have you tried looking at the source to see what your javascript function looks like?

Sean
 
Prakash Dewangan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
alert("chaeck");


there is typo. it should be "check"

is that you want us to check?
 
Kumar Raja
Ranch Hand
Posts: 548
2
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you expecting to have some sort of controller to be invoked? If Yes, then answer is No...
 
Ankit Tripathi
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you executed this,if not then execute this,You'll find the answer.
Off course there is no problem with code but it is looking quite different in comparison with commercial and real time login pages in java
problems with your code are

1.You are using client side javascript for the purpose of,"what will we put in a field" rather than checking the input fields against the invalid inputs like,"Blank username or password" so logically you are not going at right track because you are not using the javascript for the purpose,it should be used
For the first purpose all the coding should be done in a server side programming language like java over that use of databases for the username and password validation at the server side should be encouraged.

2.You must define different next views according to your inputs(Right/Wrong) which should we handled by a controller however controller is not required if your application contains only 2 or 3 JSPs or HTML pages.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!