JSP Question

L

Liquidchild

Not sure if this is the correct group, but...

I have the following jsp page, basically i want to append some text to
the username before the form is submitted, is this possible?

Thanks

S.

<HTML>
<HEAD>

<STYLE type=text/css>

A
{
FONT-SIZE: 10px;
COLOR: #000000;
FONT-STYLE: normal;
FONT-FAMILY: Arial, Helvetica, sans-serif;
TEXT-DECORATION: none
}

A:HOVER
{
color:#E600B3
}

</STYLE>
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
</HEAD>

<%
String loginid = (String) session.getAttribute("loginid");
%>

<%

String errormsg = "";
int errorcode = Integer.parseInt(request.getParameter("errorcode"));

switch( errorcode )
{
case -1:
case -4:
case -5:
case -6:
case -7:
errormsg = "LDAP login failed";
break;
case -2:
errormsg = "Username not found";
break;
case -3:
errormsg = "Password Incorrect";
break;
case -8:
errormsg = "About to lock account";
break;
case -9:
errormsg = "Account locked";
break;
case -10:
errormsg = "Password Format Invalid";
break;
case -11:
errormsg = "Session expired";
break;
case -12:
errormsg = "General Error";
break;
case -13:
errormsg = "No Cookie";
break;
}
%>

<BODY bgcolor="#ffffff">
<FORM action="" method="post" name="Sales Login" target="_parent">
<%=errormsg%>
<TABLE width="100%" cellpadding="0" cellspacing="0"
class="services_bodypurp3">
<TR class="services_bodypurp3">
<TD width="30%">
<B>Username</B>
</TD>
<TD colspan="2">
<INPUT name="Username" type="text" maxlength="200" size="30">
</TD>
</TR>
<TR class="services_bodypurp3">
<TD>
<B>Password</B>
</TD>
<TD colspan="2">
<INPUT name="UserPassword" type="password" maxlength="1024"
size="20">
</TD>
</TR>
<TR class="services_bodypurp">
<TD>
&nbsp
</TD>
<TD>
<INPUT type="hidden" name="loginid" value="<%=loginid%>"/>
<INPUT name="Submit" title="Login" type="submit" value="Login">
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
 
B

blueoxygen

Your form's action attribute is action="",so the jsp itself will
process the request.But where is your logic codes to generate
errorcode?
You should have a servlet to response this request and then set a
servelt filter to do the validation thing.
Such as generate errorcode.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top