M. Sigler

+ Follow
since Oct 21, 2004
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by M. Sigler

I am having problems retrieving the value of the selected item from a jsp page in my action page. I am not sure what I should be doing and I haven't found a good example.

I have a header on the page that shows districts in a drop down list. I have the list populated, but when it goes to the action page, I am not sure how to get the value selected. I need to use the value selected so that I can do a query based on it.

My JSP looks like this:

<%@ page language="java"%>

<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-template" prefix="template" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-nested" prefix="nested" %>

<jsp:useBean id="dstrctForm" class="com.NG.struts_class.form.dstrctForm" />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
<html:base />


<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<html:form name="dstrctForm" action="/displayAllUsers" type="com.NG.struts_class.form.dstrctForm">

<html:select property="districtId" >

<html ptions collection="district" property="value" labelProperty="label" />


<html:submit />

Here is my form bean in my struts-config:

<form-bean name="dstrctForm" type="com.NG.struts_class.form.dstrctForm">
<form-property name="distrctId" type="java.lang.String" />
<form-property name="value" type="java.util.ArrayList" />

My form looks like this:

//Created by MyEclipse Struts
// XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_2.7.101/xslt/JavaClass.xsl

package com.NG.struts_class.form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import java.util.ArrayList;

* MyEclipse Struts
* Creation date: 10-20-2004
* XDoclet definition:
* @struts:form name="dstrctForm"
public class dstrctForm extends ActionForm {

// --------------------------------------------------------- Instance Variables

/** distrct property */

private String districtId;
private ArrayList value;

// --------------------------------------------------------- Methods

* Method validate
* @param ActionMapping mapping
* @param HttpServletRequest request
* @return ActionErrors
public ActionErrors validate(
ActionMapping mapping,
HttpServletRequest request) {

ActionErrors errors = new ActionErrors();

return errors;

* @return
public String getDistrictId() {
return districtId;

* @param string
public void setDistrictId(String string) {
districtId = string;

* @return
public ArrayList getValue() {
return value;

* @param list
public void setValue(ArrayList list) {
value = list;


So when I am in DisplayAllUsersAction, I am not sure what I should be referencing to know what I select. I have tried casting the form and then doing a get on the districtId, but it gives me a null pointer exception.


19 years ago
I am having a dilemma on how to handle two forms on one jsp page. The first form is basically a header with a drop down list in it. I have a form bean and an action mapping for that. The second form is a display of users from the database again with its own form bean and action mapping. Ultimately if the user changes the information on the drop down list the report under it will change as well, but I am not sure how I can get the data from the drop down list into the second form.

If I try to retrieve anything in the second action form that has to do with the first then I get a null pointer exception.

Do I need to set something up in my struts-config.xml that allows them to talk to each other or do I need to do something totally different?

19 years ago