Hi DInakar,
If you see something printed using System.out.println(), you are
probably already setting the attribute correctly.
It has been some time since I touched JSPs, though.
Inside your input, you need to specify the value:
<input
name="username"
<c:if test="${not empty username}">${username}</c:if>
/>
Please see if it works for you.
- Ben
Am Mi., 29. Sept. 2021 um 19:30 Uhr schrieb Dinakar Reddy
<[email protected]>:
>
> Hi,
>
> We are currently using shiro framework for authentication. The requirement
> is, for invalid login the login.jsp should have the invalid username
> prepopulated in the page. Here is my sample code of the jsp. Username value
> is the desired failed login username, but the pageContext.setAttribute is not
> setting the username in the form field. Can you please help or provide
> direction in this?
>
> <%
>
> if (request.getAttribute("shiroLoginFailure")!=null) {
>
> pageContext.setAttribute("loginError",
> request.getAttribute("shiroLoginFailure"));
>
> System.out.println("username :
> "+request.getParameterMap().get("username")[0]);
>
>
>
> pageContext.setAttribute("username",
> request.getParameterMap().get("username")[0]);
>
> }
>
> %>
>
>
>
>
>
>
> <c:if test="${not empty
> loginError}">
> <div
> class="text-center error">
> You have entered an
> invalid username or password. Please try again.
> </div>
> </c:if>
> login <div class="form-group
> form-group-material">
> <label
> class="control-label text-semibold text-size-small animate">USERNAME</label>
> <input type="text"
> name="username" class="form-control inonde-login-landing"
> placeholder="username">
> </div>
> <div class="form-group
> form-group-material pb-20">
> <label
> class="control-label text-semibold text-size-small animate">PASSWORD</label>
> <input type="password"
> name="password" class="form-control inonde-login-landing"
> placeholder="password">
> </div>
> <input type="hidden"
> name="local_timezone" id="local_timezone" value="" />
> <div class="form-group">
> <button type="submit"
> class="btn bg-inonde-logo-orange btn-block" value="ACCESS NNCOMPASS">LogIn <i
> class="icon-circle-right2 position-right"></i></button>
> </div>
>
>
>
>
>
> Thanks,
>
> -Dinakar
>