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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:09:37+00:00 2026-06-01T03:09:37+00:00

Deploying on JBoss AS 7.1.0.Final. I have a very simple test app. It was

  • 0

Deploying on JBoss AS 7.1.0.Final.

I have a very simple test app. It was working as expected until the other day (famous last words) and is no longer doing the most basic thing, namely setting the value of the input component and using it in the action component. I have stripped this thing down to the basics and can not figure out what is going on.

index.xhtml is here

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:h="http://java.sun.com/jsf/html">

<h:head>
  <title>contacts</title>
</h:head>
<h:form>
    <h:outputLabel value="Message:" />
    <h:inputText value="#{contactView.siteCode}" />
    <h:commandButton  action="#{contactView.save}" value="Save" />

</h:form>

</html>

ViewScoped bean is here

@Named
@ViewScoped
public class ContactView implements Serializable {

    public ContactView() {
    }

    private String siteCode;

    public String getSiteCode() {
        System.out.println("getSiteCode: "+ siteCode);
        return siteCode;
    }

    public void setSiteCode(String siteCode) {
        System.out.println("setSiteCode: "+ siteCode);
        this.siteCode = siteCode;
    }

    public String save(){
        System.out.println("Saving sitecode: " + siteCode);
        return "index.jsf";
    }


}

What am I doing wrong? When I click on the save button I get this in the output

10:50:37,663 INFO  [stdout] (http--0.0.0.0-8080-2) setSiteCode: 22
10:50:37,663 INFO  [stdout] (http--0.0.0.0-8080-2) Saving sitecode: null
10:50:37,663 INFO  [stdout] (http--0.0.0.0-8080-2) getSiteCode: null
  • 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-01T03:09:39+00:00Added an answer on June 1, 2026 at 3:09 am

    That’s because the bean is managed by CDI @Named, not by JSF @ManagedBean. JSF scope annotations of the package javax.faces.bean only works on beans managed by JSF. On a CDI managed bean, you need to use CDI annotations from javax.enterprise.context instead. However, CDI doesn’t have a concept of the view scope. Closest is @ConversationScoped, but this is more complex to manage. When you don’t specify a scope on a CDI managed bean, it will default to the request scope.

    Make sure that your bean is managed by JSF whenever you want to use @ViewScoped.

    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.ViewScoped;
    
    @ManagedBean
    @ViewScoped
    public class ContactView implements Serializable {
        // ...
    }
    

    Further, you also need to make sure that your action methods return null or void whenever you want to retain the view scope.

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

Sidebar

Related Questions

I have am deploying 2 EARs onto JBoss AS 7.1.0.Alpha1-SNAPSHOT (post 7.0.1.Final version). Both
When deploying a Rails 3.1 app on JRuby to JBoss, I'm having a jndi/jdbc
I am working on deploying a J2ee application that I have previously been deploying
I'm working on automatically deploying to a remote JBoss AS 7.1.1 server from a
We have developed an auto deployment tool for deploying files(ear,war and jar) in jboss
Tried deploying a simple web application (jboss 5.1, jboss seam 2.2.1) on a machine.
We have a jboss server with multiple containers in it. Container1 deploying war1 and
I have a problem deploying an Axis 2 web application. I'm using Jboss 4.2.0,
got some problems deploying a java web application on jboss 7.1... Stepped through the
While deploying a dwr web app, i'm continuously getting this error. I dont know

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.