aspose file tools*
The moose likes JSP and the fly likes JSP pages-passing variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP pages-passing variables" Watch "JSP pages-passing variables" New topic
Author

JSP pages-passing variables

Sruthi Surendran
Greenhorn

Joined: Nov 28, 2007
Posts: 2
I am creating a jSP page.THe basic idea is
1.First screen asks for the input say- report id.User enters the value.
This is the textbox of the first screen.
<input name="ReportID" id="ReportID" type="TEXT" class="textfieldfont" size="30" maxlength="25" onChange="allowSubmit()">

2.SEcond screen displays the report-Id and emp-Key in two textboxes ,fetching data from database based on report_id provided.

IN the second screen the data is loaded to the textbox as follows
String sql = "SELECT * FROM CONCUR_ADMIN.CT_REPORT WHERE REPORT_ID LIKE '" + request.getParameter("ReportID") + "'", qry, cName = "";

i can EDIT the emp-key textbox value in this page.

3.on clicking the submit button another jsp page is called which updates the values and reloads the second screen

4.THe problem is:When the 2nd screen is uploaded with updaqted values,the texboxes are blank.IT is not populated with new values(no values at all in textboxes).
But,in the database the value is updated.

5.i think I am not storing the report id in a variable,so the problem occured,not sure.

6.please tell me with eg how should i correct this.

7.pLease help
lohith mk
Greenhorn

Joined: Nov 30, 2007
Posts: 6
Originally posted by Sruthi Surendran:
I am creating a jSP page.THe basic idea is
1.First screen asks for the input say- report id.User enters the value.
This is the textbox of the first screen.
<input name="ReportID" id="ReportID" type="TEXT" class="textfieldfont" size="30" maxlength="25" onChange="allowSubmit()">

2.SEcond screen displays the report-Id and emp-Key in two textboxes ,fetching data from database based on report_id provided.

IN the second screen the data is loaded to the textbox as follows
String sql = "SELECT * FROM CONCUR_ADMIN.CT_REPORT WHERE REPORT_ID LIKE '" + request.getParameter("ReportID") + "'", qry, cName = "";

i can EDIT the emp-key textbox value in this page.

3.on clicking the submit button another jsp page is called which updates the values and reloads the second screen

4.THe problem is:When the 2nd screen is uploaded with updaqted values,the texboxes are blank.IT is not populated with new values(no values at all in textboxes).
But,in the database the value is updated.

5.i think I am not storing the report id in a variable,so the problem occured,not sure.

6.please tell me with eg how should i correct this.

7.pLease help


Hi,
What i understood from your question is that after pressing the submit button you are not able to see the details in the next page if i am right with your question if this is your problem it is very simple what you have to do just retrive the details in the next jsp page by like
<% String username=request.getParameter("username");%> here the username is the property name of that jsp.
here i have given as username but in your case it is report id.
Kishore Kumar
Ranch Hand

Joined: Oct 15, 2007
Posts: 71
Hi,
My understanding from your explanation is From jsp2 on click of submit button you re calling jsp3. There you are updating the record and then redirecting to jsp2 page. If i am right, then as you said that the Report_ID is not there in the request scope. So either put the Report_ID in session or pass the Report_ID to the jsp3 as well by hidden text box from jsp2 to jsp3 with the same name of the Report_Id textbox which you have given in the in the jsp1.

I hope i am clear to you.
[ November 30, 2007: Message edited by: kesava narayana ]
Gobinath Manoj
Greenhorn

Joined: Oct 17, 2007
Posts: 11
Hi,

I got your question, you want to access the report.Id in 3rd page means you should save the report.Id value in requset(or session, application,page according to your use)scopes.

You just write in your 2nd Jsp,

<%String report.Id=request.getParameter("testbox_name");
request.setAttribute("report.Id",reportId);
%>

Now you get the report.Id in 3 page by using

<%=rquest.getAttribute("report.Id")%>

I think this is helpful for You.......


Thanks Regards <br />Gobinath.L
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP pages-passing variables