If your question is how to store them into your session object, then can
you please give more information about your environment, what code you
have tried, what is working, what is not working, etc?
I take the text from a textarea and store in a HashMap(don't know
if thats the best way)and it works:
.....
String ueberschrift = (String) req.getParameter("ueberschrift");
String untUeber = (String) req.getParameter("unterueberschrift");
String text = (String) req.getParameter("text");
setArticleText(ueberschrift, untUeber, text);
session.setAttribute("articleText",getArticleText());
res.sendRedirect(res.encodeURL("vorschau.jsp"));
.....
the method:
private synchronized void setArticleText(
String ueberschrift,
String untUeber,
String text)
{
hm.put("ueberschrift", ueberschrift);
hm.put("untUeber", untUeber);
hm.put("text", text);
}
I want to make a little preview before sending the information to the
database. The text should be shown the same way the user entered into
the form.
(jsp)
String ueberschrift = null, untUeber = null, text = null;
java.util.HashMap hm = (java.util.HashMap)
session.getAttribute("articleText");
ueberschrift = (String) hm.get("ueberschrift");
untUeber = (String) hm.get("untUeber");
text = (String) hm.get("text");
Not the best way I guess, but I'm not that experienced in
Servlet programming yet.