I tried to sent value of input from login.jsp to sentUser.jsp
,
I see many solutions but the problem is every solution pass sentUser.jsp
as action in form of login.jsp
.
And in my case, I used action for validating data and I can't remove it.
Please, I need solution. just I want to get the value of username to another JSP or in java function.
this login.jsp
:
<form class="/servletLogin" method="post" onSubmit="return validate();"
action="http://erpteskjgo01.join.gov.jo:5436/mjn/server/auth_save_click" id="LoginForm">
<h3 class="loginTitle">login</h3>
<div class="col-md-12">
<div class=" form-group">
<label for="Username">username</label>
<input type="text" class="form-control focus" maxlength="50" placeholder="username"
data-val="true" data-val-required="please enter username" id="username"
name="username" />
<span class="field-validation-valid" data-valmsg-for="Username"
data-valmsg-replace="true"></span>
</div>
</div>
<div class="col-md-12">
<div class=" form-group">
<label for="Password">password</label>
<input type="password" class="form-control focus" maxlength="50" placeholder="password"
data-val="true" data-val-required="please enter password" id="password"
name="password" />
<span class="field-validation-valid" data-valmsg-for="Password"
data-valmsg-replace="true"></span>
</div>
</div>
<div class="col-md-12">
<a id="link" href="${pageContext.request.contextPath}/servletLogin" style="visibility: hidden; color: red;">can't login?</a>
</div>
<label id="mylocation"></label>
<div class="col-md-12 col-sm-12 col-xs-12 padd0">
<span class="sperator"></span>
<input type="hidden" name="request_id" value="=reqId>">
<button class=" searchBtn" name="button" value="login">enter</button>
</div>
</form>```
//////////////////////////////////////////////////////////////////////////
and this page i want to get the value in it sentUser.jsp
``` <body>
<% String u1 = request.getParameter("username");
System.out.print("Heloooooo"+u1);%>
<form action="servletLogin">
<p>please try again</p>
</form>
</body>```