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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:09:56+00:00 2026-06-07T21:09:56+00:00

Setup: iMac 10.6.8, Apache Tomcat 6.0.16, eXist DataBase, JSP, Java, XML I have a

  • 0

Setup: iMac 10.6.8, Apache Tomcat 6.0.16, eXist DataBase, JSP, Java, XML

I have a JSP page that is used to take keyword requests from users and return XML content.

Depending on the content of the title XML tag returned to the user I am looking to also display additional content pulled from an external Java project.

My JSP to pull XML content

<div class='result-container'>
<%          
            (more code here to call content from XML database and transform)

            content = AE.getPrettyModelContent("ae", username + "transformedFeatureModel");
            out.println(content);
%>
</div>

This content is outputted with a verity of tags that are then used for styling e.g.

<title>France</title>

Gets outputted as

<div id="title">France</div> 

I am looking to preform another action on my JSP page depending on the content of the above outputted tag.

My attempt so far

<div class='concept-container'>
<%

Injector injector = Guice.createInjector(new GuiceInjector());
ConceptConnector myConceptFrance = injector.getInstance(ConceptConnector.class);

if (div id="title" == France)
{
out.println(myConceptFrance.search(myConceptFrance));
} 

%>
</div>

The Error

An error occurred at line: 150 in the jsp file: /SimpleResponse2.jsp
div cannot be resolved
149: 
150:    if (div id="title" == France)
151:    {
152:    out.println(myConceptFrance.search(myConceptFrance));
153:    }

I am not a 100% sure that what im trying to do is possible and there does not appear to be a lot of information on it. If anyone can give any tips it would be very much appreciated.

  • 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-07T21:09:58+00:00Added an answer on June 7, 2026 at 9:09 pm

    I may not fully understand, the question, but based on: if (div id="title" == France) it sounds like you’re trying to parse and edit the HTML that you output some HTML that you output here: out.println(content);. This is impossible (you can’t read the output HTML back into the Java)
    Here are some possible workarounds to consider:

    1. Save “content” as a variable java variable to be used further down the line in comparisons later (I would simplify it, save only the portion of the data you want) – I think that is likely to present problems when scaled though.
    2. Put the comparisons and checks all in the same code block before outputting anything to the page
    3. Use some AJAX to handle the later logic — (Use Javascript to check for certain features on the page and maybe call a controller servlet that acts on that)
    4. Instead of directly using out.println() when you want something to be added to the page, use a StringBuffer or something to keep a copy of what you’re printing so you can search it later. — Maybe (if you don’t need to manipulate something after printing it you do out.println AND write it to the StringBuffer, then you can search, see below:

      public static void main(String[] args){
          StringBuffer sb = new StringBuffer();
          sb.append("<div id=\"additionalData\">Italy</div> <div id=\"title\">France</div> ");
          System.out.println(sb.indexOf("id=\"title\">France</div>") > -1); // output true
          System.out.println(sb.indexOf("id=\"title\">Italy</div>") > -1); // outputs false
      
      }
      

    I’m sure there’s other solutions as well, but that’s what I’ve can think of right away. Hope this helps.

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

Sidebar

Related Questions

Setup - Tomcat 6.0.16 - MacBook I have a JSP page that is invoking
Setup: I have two views that I need to respond to the touch event,
Setup I have a website that draws RSS feeds and displays them on the
I have two Macs that I develop from, one an iMac and one a
Setup: I have an HTML page with a fieldset element. The background color of
Setup: Hibernate 4.0 (JPA 2.0), Java EE 6 I have the following problem: I
Setup iMac 10.7.4, Eclipse Indigo, Pydev, Python 2.7 I’m trying to install the Tweepy
Setup iMac OSX 10.7.4, Hi there, I am trying to install Homebrew on my
Setup: Bash Ruby 1.9.2 highline (1.6.13) Description: I'm fairly used to highline with some
Setup Mac OSX 10.6.7, Eclipse, Tomcat 1.6 I am trying to call a string

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.