Solved

Pass Parameter from Action class to JSP using Struts

Posted on 2006-06-29
2
571 Views
Last Modified: 2009-12-16
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
0
Comment
Question by:princehyderabad
2 Comments
 
LVL 16

Accepted Solution

by:
suprapto45 earned 100 total points
ID: 17015344
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
 
LVL 35

Assisted Solution

by:girionis
girionis earned 25 total points
ID: 17015952
... or put it in the session

HttpSession session = req.getSession(true);
session.setAttribute("id", <your id>);
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This video teaches viewers about errors in exception handling.

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question