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

  • SEARCH
  • Home
  • 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 1019261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:59:02+00:00 2026-05-16T10:59:02+00:00

An error occurred at line: 9 in the jsp file: /Test1.jsp The method addURL(String,

  • 0
 An error occurred at line: 9 in the jsp file: /Test1.jsp
The method addURL(String, String) is undefined for the type SearchLink
6: 
7:  if(url1!=null && url1.trim().length()!=0){
8:      myfirst.SearchLink p=new myfirst.SearchLink();
9:      String result=p.addURL(url1,source1);
10:         out.println(result);
11:         System.out.println(result);
12:     }else{

Please let me know if you need any further details for answering the error cause.
Thanks in advance

The complete jsp coding is as below.

<%@ page import="myfirst.*" %>
<%

String url1=request.getParameter("url");
String source1=request.getParameter("source");

if(url1!=null && url1.trim().length()!=0){
    myfirst.SearchLink p=new myfirst.SearchLink();
    String result=p.addURL(url1,source1);
    out.println(result);
    System.out.println(result);
}else{
    System.out.println("Not a valid url");
    out.println("Not a valid url");
}
%>

And this is my Java code named SearchLink and I have compiled this version too..

 package myfirst;

 import java.net.URL;
 import java.net.URLConnection;
 import java.sql.*;
 public class SearchLink{
public static void main(String args[]) throws Exception {
    //String link="http://hosted.ap.org";
}

public String checkURL(String link,String source)throws SQLException{
    Connection con=null;
    Statement stmt=null;
    Statement stmtR=null;
    //link="http://www.topix.com/rss/city/ellensburgwa";
    //String source="Sample";
    if(con==null){
            SQLConnection.setURL("jdbc:sqlserver://192.168.2.53\\SQL2005;user=sa;password=365media;DatabaseName=LN_ADWEEK");
            con=SQLConnection.getNewConnection();
            stmt=con.createStatement();
            stmtR=con.createStatement();
    }
    try{
        ResultSet rs;
        boolean hasRows=false;
        rs=stmt.executeQuery("select url from urlbckup where url='"+link+"'");
        while(rs.next()){
            hasRows=true;
            //String mem=rs.getString(1);
            rs.close();
            return "This URL already exists in DB";
        }
        rs.close();
        if (!hasRows)
        {

        }
        return "This URL does not exist in DB";
    }catch(Exception e){
        e.printStackTrace();
        return e.getMessage();
    }finally{
        if(stmtR!=null){
            stmtR.close();
        }
        if(stmt!=null){
            stmt.close();
        }
        if(con!= null){
            con.close();
        }
    }
}


public String addURL(String link,String source)throws SQLException{
        Connection con=null;
        Statement stmt=null;
        Statement stmtR=null;
        if(con==null){
                SQLConnection.setURL("jdbc:sqlserver://192.168.2.53\\SQL2005;user=sa;password=365media;DatabaseName=LN_ADWEEK");
                con=SQLConnection.getNewConnection();
                stmt=con.createStatement();
                stmtR=con.createStatement();
    }
        try{
            PreparedStatement insertUrlStatement = con.prepareStatement("INSERT INTO urlbckup VALUES(?, ?, ?, ?, ?)");
            insertUrlStatement.setInt(1, 21211);
            insertUrlStatement.setString(2, link);
            insertUrlStatement.setString(3, source);
            insertUrlStatement.setInt(4, 1);
            insertUrlStatement.setInt(5, 0);
            insertUrlStatement.executeUpdate();
            insertUrlStatement.close();
            return "The URL has been added to the Database";}
        catch(Exception e){
            e.printStackTrace();
            return e.getMessage();
        }finally{
            if(stmtR!=null){
                stmtR.close();
            }
            if(stmt!=null){
                stmt.close();
            }
            if(con!= null){
                con.close();
            }
    }


}

}

  • 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-05-16T10:59:03+00:00Added an answer on May 16, 2026 at 10:59 am

    You should redeploy your application.

    In most IDEs, when you deploy web applications jsp pages can still be edited and “redeployed” on the fly onto the web container. But with classes, you need to recompile your code and redeploy your application.

    Now some IDE and auto redeploy your application on save. And there are projects like jrebel which allow you to change classes into your application without redeploying it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

An error has occurred while establishing a connection to the server. When connecting to
Parser Error Message: The entry 'SiteSqlServer' has already been added. Source Error: Line 23:
Error message: fatal: git checkout: updating paths is incompatible with switching branches/forcing How to
This error just started popping up all over our site. Permission denied to call
The error I'm getting: in /Users/robert/Documents/funWithFrameworks/build/Debug-iphonesimulator/funWithFrameworks.framework/funWithFrameworks, can't link with a main executable Cliff notes:
This error seems to just pop up now and again. It is not restricted
This error message appears on a colleague's machine when he tries to launch a
Fatal error: Allowed memory size of 31457280 bytes exhausted (tried to allocate 9828 bytes).
Compiler error CS0283 indicates that only the basic POD types (as well as strings,
Came across this error today. Wondering if anyone can tell me what it means:

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.