Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8487085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:08:02+00:00 2026-06-10T21:08:02+00:00

I’m creating an app, that displayes a String from a database. This String is

  • 0

I’m creating an app, that displayes a String from a database. This String is then displayed in a textbox that cannot be edited(read only).

I now require that varible (ID passed) in the text box to be compared with a column in a SQL database table which is an identical String. Once the matching String is found I need to update other columns based on the queries.

when i use request.getParameter() method it is giving output as null.

i need it to be done purely in jsp. please help.

<%@page import="java.sql.*"%>  
<%@page import="java.lang.*"%>  
<%@page import="java.io.*"%>  
<%@page language="Java"%>  

<html>  
<head>  
<script type="text/javascript">  
function move(){  
 document.getElementById('tgt1').value = document.getElementById('Allocation').value;  
 document.getElementById('Allocation').value="";  
 document.getElementById("Send").disabled=true;  
}  
function UnBlock()  
{  
    document.getElementById("tgt1").value="";  
    document.getElementById("Send").disabled=false;  
    document.getElementById("tgt2").style.display="block";  
    document.getElementById("Query_but").style.display="block";  
   }  
function UnBlock_Only(){  
    document.getElementById("Send").disabled=false;  
    document.getElementById("Query").disabled=true;  
}  
function Alloc_Insert()  
{  
    document.myform.action="Alloc_Insert.jsp";  
    document.myform.method="post";  
    document.myform.submit();  
}  
</script>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<style type="text/css">  
body {  
    margin-top: 20px;  
    margin-left: 30px;  
}  
</style>  
</head>  
<body>  
    <form name="myform" method="post" action="Alloc_Insert.jsp">  
<%  
try {  
    String sessname=(String)session.getAttribute("myusername");  
    PreparedStatement ps,ps2=null;  
    ResultSet rs=null;  
    Statement st=null;  
    Connection con=null;  
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();  
    con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "system", "tiger");  
    ps=con.prepareStatement("select DBID from Scope1 where specialist IS Null");  
    rs = ps.executeQuery();  
    if(rs.next())  
    {  
  %>  
<input type="text" name="Allocation" size="75" id="Allocation" value="<%=rs.getString("DBID")%>" readonly="readonly">  
<%  
}  
}  
catch(Exception e){  
out.println(e);  
}  
%>  
<a href="Alloc_Insert.jsp" value="Allocate" id="Send" name="Send" onclick="Clicked()">Allocate</a><br/>  
<br/><br/><br/><br/><br/><br/>  
<table>  
<tr>  
<input type="text" id="tgt1" size="100">  
<td><input type="button"value="Query" id="Query" onClic="UnBlock()"></td>  
<td><input type="button" value="Westlaw Verification" onClick="UnBlock_Only()"></td>  
</tr><br/>  
</table><textarea name="tgt2" id="tgt2" cols="30" rows="5" style="display:none"></textarea>  
<table><tr><td><a href="Insert.jsp" style="display: none" id="Query_but" onclick="Add_Query()">Submit Query</a></td></tr></table>  
<table><tr><td><input type="text" value="" id="demo" size="75"></td></tr></table>  
</form>  
 </body>  
</html>

and the jsp used to compare the data is as below

<%@page import="java.sql.PreparedStatement"%>  
<%@page import="java.sql.DriverManager"%>  
<%@page import="java.sql.DriverManager"%>  
<%@page import="java.sql.Connection"%>  
<%@page import="java.sql.ResultSet"%>  
<%@page import="java.sql.ResultSet"%>  
<%@page import="java.lang.String"%>  

<html>  
    <head>  
    </head>  
    <body>  
<%   
     try{  
            ResultSet rs=null;  
            String Add=request.getParameter("Allocation.text");  
            String user=(String) session.getAttribute("myusername");  
            Class.forName("oracle.jdbc.driver.OracleDriver");  
            java.util.Date today = new java.util.Date();  
            java.sql.Timestamp t= new java.sql.Timestamp(today.getTime());  
            Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","tiger");  
            PreparedStatement ps=con.prepareStatement("Update Scope1 SET ALLOCATED=?, SPECIALIST=? WHERE DBID='"+Add+"'");  
            ps.setTimestamp(1, t);  
            ps.setString(2, user);  
            /*ps.setString(3, Add_U);*/  
            ps.executeUpdate();  
            out.println(user);  
            out.println(con);  
            out.println(t);  
            out.println(Add);  
            con.commit();  
             }  
        catch(Exception e)  
                       {  
            out.println(e);  
                       }  
%>  
    </body>  
</html> 

please help me with this at the earliest.

Thank You

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T21:08:03+00:00Added an answer on June 10, 2026 at 9:08 pm

    Are you are getting null for this statement

    String Add=request.getParameter("Allocation.text"); 
    

    If so change to the following and try.

     String Add=request.getParameter("Allocation"); 
    
    <input type="text" name="Allocation" size="75" 
    id="Allocation" value="<%=rs.getString("DBID")%>" 
    readonly="readonly"> 
    

    Regards

    Edit 1

    This line of code makes value of Allocation to null. Are you calling move() javascript function anywhere? document.getElementById('Allocation').value="";

    If so you should get the value from tgt1 because you are assigning Allocation value to tgt1 in this statement

        document.getElementById('tgt1').value = 
    document.getElementById('Allocation').value;  
    

    Edit 3

    if you want to navigate to your second page by clicking hyperlink, you could try as following

    <a href="Alloc_Insert.jsp?val=<%=rs.getString("DBID")%>" />
    

    and in your second jsp

    request.getParameter("val").
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I've got a string that has curly quotes in it. I'd like to replace
I know there's a lot of other questions out there that deal with this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a view passing on information from a database: def serve_article(request, id): served_article
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.