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

The Archive Base Latest Questions

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

I have a servlet that reads an external HTML file as a String. I

  • 0

I have a servlet that reads an external HTML file as a String. I want to add a specific button inside this html which then makes reference to one of my EJB.

Therefore I inserted a:

String button=<h:commandButton value="Test" action="#{myBean.buttonMethod()}" />;

BUT this expression is not evaluated in the output of the servlet by:

out.println(thePage);

I do see just the code for the button, but it is not interpreted.
How can I insert such a reference to one of my method within a servlet dynamically?

  • 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-12T03:11:23+00:00Added an answer on June 12, 2026 at 3:11 am

    That’s not HTML code. That’s JSF code. JSF code is supposed to be executed by declaring the tags in a Facelets or JSP file and having it processed by the FacesServlet by invoking its URL. It’s definitely not the webbrowser who understands JSF as you seemed to think. It only understands HTML.

    It’s unclear what the concrete functional requirement and why you’re attempting to mix JSF and Servlets this way (I can’t for life imagine a sensible real world reason for this), but assuming that you’ve a plain HTML <form> which submits to a particular servlet, then one of the ways is to just write normal HTML code instead (which is also what JSF ultimately produces).

    <input type="submit" name="buttonMethod" value="Test" />
    

    In the servlet behind that particular <form action>, do something like

    if (request.getParameter("buttonMethod") != null) {
        myBean.buttonMethod();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a servlet which returns as response an html page that also includes
I have a web servlet that returns a json which is stored in my
I have this java servlet that grabs information from a form, I need to
I have created a servlet that passes a string variable strname to a JSP
I have a servlet that construct response to a media file request by reading
let's say i have a servlet that forwards a request to a jsp file
I have a cookie which is generated from a servlet and that I would
I have a servlet that users post a XML file to. I read that
We have a servlet that accepts requests and performs certain actions on external systems.
I have a Servlet in Tomcat 5.5 that reads local images sitting on a

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.