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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:11:19+00:00 2026-06-16T23:11:19+00:00

Used this StackOverflow answer to try an implement a submitless form. The page consists

  • 0

Used this StackOverflow answer to try an implement a submitless form. The page consists of a selectomenu control and a table. On change of the selection I wish to refresh the table body. The page loads without issues, but when the selection is made I get the following error occurs:

10:22:48,241 ERROR [[FacesServlet]] Servlet.service() for servlet FacesServlet threw exception: java.lang.NullPointerException
    at com.sun.faces.context.PartialViewContextImpl.createPartialResponseWriter(PartialViewContextImpl.java:441) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at com.sun.faces.context.PartialViewContextImpl.access$300(PartialViewContextImpl.java:71) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at com.sun.faces.context.PartialViewContextImpl$DelayedInitPartialResponseWriter.getWrapped(PartialViewContextImpl.java:582) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at javax.faces.context.PartialResponseWriter.startDocument(PartialResponseWriter.java:115) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
    at com.sun.faces.context.AjaxExceptionHandlerImpl.handlePartialResponseError(AjaxExceptionHandlerImpl.java:199) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at com.sun.faces.context.AjaxExceptionHandlerImpl.handle(AjaxExceptionHandlerImpl.java:123) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
    at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
    at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:505) [jbossweb-7.0.13.Final.jar:]
    at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:445) [jbossweb-7.0.13.Final.jar:]
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
    at java.lang.Thread.run(Thread.java:636) [rt.jar:1.6.0_18]

I’m using JBoss-AS-7.1.1, and the selectonmenu looks like this:

<h:selectOneMenu id="ship"
             value="#{shipManager.current}">
    <f:selectItems value="#{shipManager.list}"
               var="ship"
               itemValue="#{ship}"
               itemLabel="#{ship.name}" />
    <f:ajax listener="#{shipManager.changeShip}" />
</h:selectOneMenu> 

If I remove the ajax component then no issues although (of course) the shipManager is not updated.

Once I have the selection made I would then like to add the renderer part to refresh my table body.

Many thanks for any help given.

Steve

As requested here is my XHTML code:

<?xml version='1.0' encoding='UTF-8' ?>
<!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:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets">

  <h:head>
    <title>Voyage Cruises</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link type="text/css" rel="stylesheet" media="all" href="/css/screen.css"/>
    <link type="text/css" rel="stylesheet" media="all" href="/css/cruise.css"/>
    <script src="http://open.mapquestapi.com/sdk/js/v7.0.s/mqa.toolkit.js"></script> 
    <script src="js/map.js" ></script>
    <script src="js/cruise.js" ></script>
  </h:head>

  <h:body>
    <div id="page">
      <div id="float-map">
    <div id="map"></div>
      </div>

      <h:form id="ship-form">

    <div id="ship-controls">
      <div class="float-ctrls">
        <a href="/ports.html" title="Find Ports"><img src="/images/action_search.png" alt="Find Ports"/></a>
      </div>
      <div>
        <span id="ship-selector" >
          <h:selectOneMenu id="ship"
                   value="#{shipManager.current}">
        <f:selectItems value="#{shipManager.list}"
                   var="ship"
                   itemValue="#{ship}"
                   itemLabel="#{ship.name}" />
        <f:ajax execute="ship" render="@form" listener="#{shipManager.changeShip}" />
          </h:selectOneMenu> 
        </span>
        <select id="month" />
        <select id="year" />
        <br />
        <span class="input-container"><b>Tonnage:</b><input id="tonnage" type="text" size="6" value="30,277" /></span>
        <span class="input-container"><b>Audit Time:</b><input id="audit" type="text" size="2" value="6" /></span>
        <span class="input-container"><b>Fleet:</b><input id="fleet" type="text" size="20" value="P&amp;O" /></span>
      </div>
    </div>

    <table class="cruise">
      <thead>
        <tr>
          <th class="date">Date</th>
          <th class="port">Port</th>
          <th class="arrive">Arrive</th>
          <th class="depart">Depart</th>
        </tr>
      </thead>
      <tbody>
        <ui:repeat var="cruise"
               value="#{cruiseManager.list}" 
               varStatus="table">
          <tr class="#{table.even ? 'even' : 'odd'}">
        <td class="date">
          <h:outputFormat value="{0, date,d MMM}">
            <f:param value="#{cruise.date}" />
          </h:outputFormat>
        </td>
        <h:panelGroup rendered="#{null != cruise.port}">
          <td class="port">#{cruise.port.name}</td>
          <td class="arrive">
            <h:outputFormat rendered="#{null != cruise.arrival}"
                    styleClass="#{cruise.arrivalEstimated ? 'est-time' : 'act-time'}"
                    value="{0, date,HH:mm}">
              <f:param value="#{cruise.arrival}" />
            </h:outputFormat>
          </td>
          <td class="depart">
            <h:outputFormat rendered="#{null != cruise.departure}"
                    styleClass="#{cruise.departureEstimated ? 'est-time' : 'act-time'}"
                    value="{0, date,HH:mm}">
              <f:param value="#{cruise.departure}" />
            </h:outputFormat>
          </td>
        </h:panelGroup>
        <h:panelGroup rendered="#{null == cruise.port}">
          <td class="at-sea" colspan="3">At Sea</td>
        </h:panelGroup>
          </tr>
        </ui:repeat>
      </tbody>
    </table>

      </h:form>
    </div>
  </h:body>
</html>

And the ShipManager:

package com.nutrastat.voyager.web;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.event.AjaxBehaviorEvent;

import com.nutrastat.voyager.db.HarbourMasterLocal;
import com.nutrastat.voyager.db.ShipEntity;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@ManagedBean
@ViewScoped
public class ShipManager 
    implements Serializable {

    static final long serialVersionUID = -3017226836104715117L;

    private transient final Logger log;

    private ShipEntity currentShip;

    @EJB
    private HarbourMasterLocal harbourMaster;

    public ShipManager() {
    log = LoggerFactory.getLogger(getClass());
    }

    public ShipEntity getCurrent() {
    if (log.isInfoEnabled())
        log.info("getCurrent(): " + currentShip);
    return currentShip;
    }

    public void setCurrent(ShipEntity ship) {
    if (log.isInfoEnabled())
        log.info("setCurrent(" + currentShip + "): " + ship);
    currentShip = ship;
    }

    public void changeShip(AjaxBehaviorEvent evt) {
    if (log.isInfoEnabled())
        log.info("Ship now: " + currentShip);
    }

    public List<ShipEntity> getList() {
    try {
        return harbourMaster.listShips();

    } catch (Exception cause) {
        log.error("Getting the list of ships", cause);
        return new ArrayList<ShipEntity>(0);
    }
    }
}
  • 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-16T23:11:21+00:00Added an answer on June 16, 2026 at 11:11 pm

    Your stack trace looks incomplete in that it doesn’t actually refer to your code(which is where I’d expect the npe be thrown). That notwithstanding, your select menu doesn’t have a converter, so any other problems aside, your form would probably still not save or register the selection

    1. Implement a JSF converter and declare it on that selectonemenu. This is mandatory when a select type component needs to select and save complex POJO types You can look at this example

    2. Try to get rid of that gigantic <h:form/> in your markup. There are too many other components in that form that could be causing you problems. Break the components into smaller chunks in separate forms

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

Sidebar

Related Questions

I used this code to print the current page: <form> <input type=button value=Print onClick=window.print();
I've used validator errors customization example from this answer: https://stackoverflow.com/a/4881030/822947 , but I need
Code below from other stackoverflow answer is used in jqGrid to implement checkbox using
I have used Jim McCurdy's very helpful answer to this StackOverflow question to avoid
I used this tutorial to create a basic Javascript function for implementing change during
Building on this answer: https://stackoverflow.com/a/2349824/1382306 Are there further guidelines in A and B's usages,
Reading this stackoverflow answer : QWeakPointer - Do you sense a reoccurring pattern? Just
i used this code: List<string> lists=new List<string>(apple,orange,banana,apple,mang0,orange); string names; names=lists.Distinct() is that correct?
I used this MSDN example to construct my console host app: http://msdn.microsoft.com/en-us/library/ms731758.aspx It works
i used this script to animate some divs with jquery and css. now i

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.