Solved

Pass Parameter from Action class to JSP using Struts

Posted on 2006-06-29
2
574 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

717 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