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 8726115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:11:12+00:00 2026-06-13T08:11:12+00:00

I am trying to show the message based on the text shown on webpage

  • 0

I am trying to show the message based on the text shown on webpage after a particular action. If the webpage contains text MESSAGE HAS BEEN SUBMITTED SUCCESSFULLY, I want to print Message sent successfully on the screen otherwise MESSAGE SENDING FAILED. Everything is working fine but for one thing.

PrintWriter printWriter = new PrintWriter(new OutputStreamWriter(sendConnection.getOutputStream()), true);
        printWriter.print(sendContent);
        printWriter.flush();
        printWriter.close();
        //Reading the returned web page to analyse whether the operation was sucessfull

        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(sendConnection.getInputStream()));

        StringBuilder SendResult = new StringBuilder();
        String line;

        while ((line = bufferedReader.readLine()) != null) {
            SendResult.append(line);
        }

if (SendResult.toString().contains("MESSAGE HAS BEEN SUBMITTED SUCCESSFULLY")) {
            System.out.println("Message sent to " + phoneNumber + " successfully.");
        } else {
            System.err.println("Message could not send to " + phoneNumber + ". Also check login credentials");
        }
        bufferedReader.close();

The problem is that even if the webpage contains the text MESSAGE HAS BEEN SUBMITTED SUCCESSFULLY, the condition always goes into ELSE part and show MESSAGE SENDING FAILED but thats not true because the message has been sent and i see the MESSAGE HAS BEEN SUBMITTED SUCCESSFULLY on the webpage.

Can anyone tell me where am i going wrong?

  • 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-13T08:11:13+00:00Added an answer on June 13, 2026 at 8:11 am

    Try this:

    if (SendResult.toString().trim().contains("MESSAGEHASBEENSUBMITTEDSUCCESSFULLY")) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to build a user based message system. I'd like messages to show
I have below query I am trying to show message 'No SubSource for this
please i am trying to make the message show on newline as the customer
See this question. How to show popup message like in stackoverflow I am trying
Im trying to make a JDialog that will show the user a dynamic message
I'm trying to show a list of links (in index.html) to text files in
I am trying to create a very simple (text based for now) email app
Has anyone been able to add primitives in XAML in WinRT? I'm trying to
I was trying to make weather based PHP script to show weather related data.But,I'm
Trying to show a label only when a certain item in a combo is

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.