Pass Parameter from Action class to JSP using Struts

hi,

I get few parameter from JSP page, fwd to Action class which writes those parameter into DB after auto-generating ID.
DB -table
ID (auto generate), Name, Question, Email.

what I'm trying to do is afer action class writes to DB. I wanna get that generated ID and fwd to JSP which display fancy msg and #ID.

Action Class.
...
...
ResultSet rs = st.executeQuery("select max(id) as ID from Test123");
            rs.next();
            int rowid=rs.getInt("ID");
          status ="pass";
..
return (mapping.findForward(status));
..

thx,
PH
princehyderabadAsked:
Who is Participating?
 
suprapto45Connect With a Mentor Commented:
Why don't you just send the parameter from request?

request.setAttribute("id", Integer.toString(rowid));

Then you can simply access the request object from your JSP

David
0
 
girionisConnect With a Mentor Commented:
... or put it in the session

HttpSession session = req.getSession(true);
session.setAttribute("id", <your id>);
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.