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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:57:25+00:00 2026-05-11T17:57:25+00:00

After the user fills my backing bean with info through the forms, I want

  • 0

After the user fills my backing bean with info through the forms, I want to process the instance in Java code (such as JAXB marshalling).

So at the moment i’m doing this like so:

<% OtherBean.method(myBackingBean); %>

which is – if i’m right – not quite an up to date solution 🙂 So how can I make this happen in a ‘better’ way?

Thanks in advance,
Daniel.

  • 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-11T17:57:25+00:00Added an answer on May 11, 2026 at 5:57 pm

    One solution is to add an action method to the bean – it is possible to have it process itself.

    For example, this simple bean:

    public class SimpleBean {
    
      private String forename;
      private String surname;
    
      public String processData() {
        // TODO: real work
        System.out.println("forename=" + forename);
        System.out.println("surname=" + surname);
        return null; // optional navigation rule
      }
    
      public String getForename() {
        return forename;
      }
    
      public void setForename(String forename) {
        this.forename = forename;
      }
    
      public String getSurname() {
        return surname;
      }
    
      public void setSurname(String surname) {
        this.surname = surname;
      }
    
    }
    

    …defined in WEB-INF/faces-config.xml:

    <managed-bean>
        <managed-bean-name>simpleBean</managed-bean-name>
        <managed-bean-class>simplebean.SimpleBean</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    

    …can be processed using the this JSP:

    <?xml version="1.0" encoding="UTF-8" ?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
      <jsp:directive.page language="java"
        contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" />
      <jsp:text>
        <![CDATA[<?xml version="1.0" encoding="UTF-8" ?>]]>
      </jsp:text>
      <jsp:text>
        <![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">]]>
      </jsp:text>
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <title>Enter Name</title>
      </head>
      <body>
      <f:view>
        <h:form>
          <h:panelGrid columns="2">
            <h:outputText value="forename:" />
            <h:inputText id="it1" value="#{simpleBean.forename}" />
            <h:outputText value="surname:" />
            <h:inputText id="it2" value="#{simpleBean.surname}" />
          </h:panelGrid>
          <h:commandButton action="#{simpleBean.processData}"
            value="process" />
        </h:form>
      </f:view>
      </body>
      </html>
    </jsp:root>
    

    Note the method binding #{simpleBean.processData}. This must be a public method that takes no arguments and returns a String argument (which can be used for page navigation if desired).

    This isn’t the only way to go about this, but it is fairly straightforward.

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

Sidebar

Related Questions

I have a form that and after the user fills in this form, I
I want to offer audio files for download on my site, after a user
In my app after user press start button I execute some code in for
I want to INSERT VALUES after user has clicked OK on the confirmation box.
I want my recaptcha to appear only after user clicks submit button on the
After a user fills in a form but does not fill a required field
After a user fills his address in a text field and hits the submit
Here's my issue: I have a html form that after a user fills in
Is it safe to login user automatically after registration? User fills registration form, some
The user fills in the form his email and password. After submiting the form,

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.