You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Oliver Thiel <th...@gmx.de> on 2004/02/05 17:05:48 UTC
Global Variable - SetupServlet
Hi all,
I wrote a struts app with database 'driven' forms using iBatis.
For this purpose I wrote a 'SetupServlet' which creates some
LinkedHashMaps e.g. register == {username=, password=, ..}
and sets them into the Servlet Context
servletContext.setAttribute("register", register);
In the reset() Methode of my RegisterForm.java I do something like that:
public class RegisterForm extends ActionForm {
Map register = new LinkedHashMap();
:
public void reset(ActionMapping arg0, HttpServletRequest arg1) {
register = servletContext.getAttribute("register");
arg1.setAttribute("regiser",fields);
}
}
And in my register.jsp:
<logic:iterate id="field" name="fields">
<TR>
<TD width="40%"><bean:write name="field" property="key"/>:</TD>
<TD><input type="text" name="field(<bean:write name="field"
property="key" />)" value="<bean:write name="field" property="value"
/>" class="Feld"></TD>
</TR>
</logic:iterate>
Until this point anything works fine I see the form and I can insert
data .
BUT I can also see the INSERTED data from another machine - as if they
where written into the ServletContext?!?
What am I doing wrong? OR: What can I do against this really BAD effect?
Oliver