Solved

How Do I Pass  MySeq.NEXTVAL (value to jsp Tag)

Posted on 2009-07-02
2
435 Views
Last Modified: 2012-05-07
Request
          I was hoping that someone could assist with what I think is a pretty easy problem to solve but for me has proved to be pretty tricky. I would like to return the NEXTVAL of a sequence to my field labeled PK3.

Accomplishments
I am able to generate nextval of a sequence ("select MySeq.NEXTVAL FROM dual"); as shown in the preparedstatement found below

Question:
When user selects form, How do I automatically return the nextval of my sequence (preparedstatement) to an html field labeled PK3?

My Attempts
I have tried every combination of coding, to return nextval to field PK3 except the one that works.  I can say this, the preparedstatement does work.  It does select nextval for MySeq but I cannot seem to be able to pass the value to the field labeled PK3
<%
Driver DriverRecordset1 = (Driver)Class.forName(MM_conn_CFOB_oracle_DRIVER).newInstance();
Connection ConnRecordset1 = DriverManager.getConnection(MM_conn_CFOB_oracle_STRING,MM_conn_CFOB_oracle_USERNAME,MM_conn_CFOB_oracle_PASSWORD);
PreparedStatement StatementRecordset1 = ConnRecordset1.prepareStatement("select MySeq.NEXTVAL FROM dual");
ResultSet Recordset1 = StatementRecordset1.executeQuery();
Object Recordset1_data;
int Recordset1_numRows = 0;
%>
 
 
<tr>
<td align="left" class="faxtext">PASS Nextval using JSP <input name="PK3" type="text" id="PK3" Value=<%=need code %>
</td></tr>

Open in new window

0
Comment
Question by:rg20
2 Comments
 
LVL 13

Accepted Solution

by:
Murali Murugesan earned 500 total points
ID: 24769405
try this,

<td align="left" class="faxtext">PASS Nextval using JSP <input name="PK3" type="text" id="PK3" Value=<%if(Recordset1.next()){out.println(Recordset1.getInt(1);} %>


0
 
LVL 9

Author Comment

by:rg20
ID: 24769554
Very good with the couple of small codding errors such as end html tag and a parethisis. code works as follows:

<td align="left" class="faxtext">PASS Nextval using JSP
<input name="PK3" type="text" id="PK3" Value=<%if(Recordset1.next()){out.println(Recordset1.getInt(1));} %>>

Thank you!!!!!! I have been working on this for four weeks.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
constuctor calling other constructor 2 76
attribute vs parameter and setter vs add method 17 86
reflection example 3 102
null output 3 25
An article on effective troubleshooting
As a business owner, there are many things that keep you up at night. Profit margins, employee retention, human resource protocols, whether your product or service will remain competitive. When you own or manage a technology company that operates la…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

809 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