how are you writing your jsp?

<html:text name="loginForm" property="username"/>
are you doing like this?

-----Original Message-----
From: Stefan Berger [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 16, 2003 2:06 PM
To: [EMAIL PROTECTED]
Subject: Input fields are empty after validation error


Hi. 
 
I have a very strange situation and no idea what happend and how to fix
it. 
At the login.jsp page i have 3 fields to fill in. When the user makes an
error, i want to redisplay the same page with the errors.
But i display the same page with the errors but the input fields are
empty. I do not reset this fields are something else, but they always
empty.
What is here wrong.
 
I want redisplay input data and the errors. Please advice me in details.
I got a lot of general advices but the didnt work
 
Best Regards 
 
Stefan
 
 
 
 
[inside struts-config.xml]
<!-- verifies the loginForm -->

<action 

path="/login"

type="com.softborg.dentist.action.Login"

name="loginForm"

scope="session">

<forward name="success" path="/goMainPage.do"

/>

<forward name="failure" path="/login.jsp" 

/>

</action>

 

[action]

public ActionForward execute(

ActionMapping mapping,

ActionForm form,

HttpServletRequest request,

HttpServletResponse response)

throws Exception {

// Extract attributes and parameters we will need

Locale locale = getLocale(request);

MessageResources messages = getResources(request);

HttpSession session = request.getSession();

ActionErrors errors = new ActionErrors();

LoginForm loginForm = (LoginForm) form;

log.debug("username=" + loginForm.getUserName());

log.debug("password = " + loginForm.getPassword());

log.debug("shortSign = " + loginForm.getShortSign());

String username = loginForm.getUserName();

String password = loginForm.getPassword();

String shortSign = loginForm.getShortSign();

if (username == null || username.length() == 0) {

errors.add("userName", new ActionError("error.login.nologin"));

}

if (shortSign == null || shortSign.length() == 0) {

errors.add("shortSign", new ActionError("error.login.noshortsign"));

}

if (password == null || password.length() == 0) {

errors.add("password", new ActionError("error.login.nopassword"));

}

// Report any errors we have discovered back to the original form

if (!errors.isEmpty()) {

log.debug("Error found");

saveErrors(request, errors);

return mapping.findForward("failure");

}



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to