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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:35:38+00:00 2026-06-04T17:35:38+00:00

Setup – Tomcat 6.0.16 – MacBook I have a JSP page that is invoking

  • 0

Setup – Tomcat 6.0.16 – MacBook

I have a JSP page that is invoking a separate Java application that searches the web and returns content. I am looking to display this content on my JSP page.

My JSP code – Which invokes the below JAVA

System.out.println("Test3");
Injector injector = Guice.createInjector(new GuiceInjector());
Run r = injector.getInstance(Run.class);
r.runSliceConsumer();   

My JAVA – This works and prints my content to the Terminal window.

if (sliceHits == null) {
    System.err.println("Timeout occurred while fetching slices");
    return;
}
if (!sliceHits.isEmpty()) {
    System.out.println("Found some slices Yuhuuuu ! :-) ");
    String sliceContent = createSlices(sliceHits);
    System.out.println("sliceContent:");
    System.out.println(sliceContent);
} 
else {
    System.out.println("No Slices were found for this query");
}

My issue is that i want to display the content above in my JSP web page and not just the Terminal window. I assume that as the connection is made one way, my JSP invokes my JAVA that i should be able to just display the results but im having a few problems, i hope its just with my Syntax.

My attempt in JSP

<div id="result-page-query" align='center'>
<%
    sliceContent = createSlices(sliceHits);
    out.println(sliceContent);
%>
</div>

I’m not sure if I’m explaining this right, but essentially I’m trying to display the content of “sliceContent” on my Webpage

Thanks

EDIT:

Hi as suggest below by jddsantaella and Hardik Mishra I had to import the necessary packages. I then created an object in this case “kContent” and executed the method.

The solution was similar to the below

<%

    Run kContent = injector.getInstance(Run.class);
    kContent.runSliceConsumer();
    out.println(kContent);
%>
  • 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-04T17:35:40+00:00Added an answer on June 4, 2026 at 5:35 pm

    You should not use Java code in your JSP, it is not recommendable. Anyway, you can print the value returned by a method doing something like this:

    ...
    <%=myObjetct.myMethod(...)%>
    ...
    

    In your attempt is not clear what createSlices is. I think it could be

    <%=r.runSliceConsumer()%>
    

    assuming that your runSliceConsumer method is returning something

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

Sidebar

Related Questions

Setup : I have a Struts web application where I use displaytag elements to
Setup: I have a COM DLL that calls a method inside a managed C#
Setup: I have two views that I need to respond to the touch event,
Setup: ASP.net 3.5, Linq-to-Sql. Separate Web and DB servers (each 8-core, 8GB RAM). 4
Setup I have a website that draws RSS feeds and displays them on the
Setup: I have an HTML page with a fieldset element. The background color of
Setup I have a VBScript for driving the stress testing of a web service.
Setup: I'm opening a new window via js that is a classic asp page
Setup: I have a UITextView inside a UITableViewCell 's contentView . I want it
Setup : Using PowerBuilder 6.5. I have a composite report (with a report header)

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.