Yes I agree..I cannot find the problem, I think it is much better if there's
2 pairs of eyes looking.

Here is the Action code.
public class SortListAction extends org.apache.struts.action.Action {

    /* forward name="success" path="" */
    private final static String SORT_LIST = "sortList";

    public ActionForward execute(ActionMapping mapping, ActionForm  form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        SortListActionForm slaf = new SortListActionForm();
        MediaDao mediaDao = new MediaDao();
        ArrayList aList = mediaDao.sortMediaList(slaf.getFormatList());

        request.setAttribute("medialist", aList.iterator());
        return mapping.findForward(SORT_LIST);

    }
}

And here I have the ActionForm (I commented validate method since user will
be selecting choices I defined):

package formbeans;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 *
 * @author wst_01
 */
public class SortListActionForm extends org.apache.struts.action.ActionForm{

   private String formatList;

   public SortListActionForm() {
       super();
       // TODO Auto-generated constructor stub
   }

//   public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request) {
//       ActionErrors errors = new ActionErrors();
//       if (getName() == null || getName().length() < 1) {
//           errors.add("name", new ActionMessage("error.name.required"));
//           // TODO: add 'error.name.required' key to your resources
//       }
//       return errors;
//   }

    public String getFormatList() {
        return formatList;
    }

    public void setFormatList(String formatList) {
        this.formatList = formatList;
    }
}

And lastly, I have here the Struts-config.xml


<struts-config>
    <data-sources>

    </data-sources>
    <form-beans>
        <form-bean name="SortListActionForm" type="
formbeans.SortListActionForm"/>
        <form-bean name="SortListActionForm" type="
formbeans.SortListActionForm"/>
        <form-bean name="LoginForm" type="formbeans.LoginForm"/>

    </form-beans>

    <global-exceptions>

    </global-exceptions>

    <global-forwards>
        <forward name="welcome"  path="/Welcome.do"/>
    </global-forwards>

    <action-mappings>
        <action input="/administratorsLogin.jsp" name="LoginForm"
path="/login" scope="request" type="actions.LoginAction">
            <forward name="loginSuccess" path="/adminPage.jsp"/>
            <forward name="loginFail" path="/administratorsLogin.jsp"/>
        </action>
        <action path="/mediaList" scope="request" type="
actions.MediaListAction">
            <forward name="mediaListView" path="/adminPage.jsp"/>
        </action>
        <action input="/adminPage.jsp" name="SortListActionForm"
path="/sortList" scope="request" type="actions.SortListAction"
validate="true">
            <forward name="sortList" path="/adminPage.jsp"/>
        </action>

I attached files you requested, I think it's much better to see them in
color..=) I also attached files related to databases..(just incase you might
need them).

God bless,
Ryan Webb -- Philippines

On Thu, Mar 6, 2008 at 4:42 PM, Antonio Petrelli <[EMAIL PROTECTED]>
wrote:

> 2008/3/6, ryan webb <[EMAIL PROTECTED]>:
> >
> > Yes I did select an element I choose DVD+R then when I click sort now
> > button
> > the WebPage exploded
> > containing Tomcat Error Message. (null pointer exception).
>
>
>
> Mmmm this is strange. Can I see your Action, ActionForm and
> struts-config.xml (related to this action) code?
>
> Antonio
>
<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
          "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd";>


<struts-config>
    <data-sources>
        
    </data-sources>
    <form-beans>
        <form-bean name="SortListActionForm" type="formbeans.SortListActionForm"/>
        <form-bean name="SortListActionForm" type="formbeans.SortListActionForm"/>
        <form-bean name="LoginForm" type="formbeans.LoginForm"/>
    
    </form-beans>
    
    <global-exceptions>
    
    </global-exceptions>

    <global-forwards>
        <forward name="welcome"  path="/Welcome.do"/>
    </global-forwards>

    <action-mappings>
        <action input="/administratorsLogin.jsp" name="LoginForm" path="/login" scope="request" type="actions.LoginAction">
            <forward name="loginSuccess" path="/adminPage.jsp"/>
            <forward name="loginFail" path="/administratorsLogin.jsp"/>
        </action>
        <action path="/mediaList" scope="request" type="actions.MediaListAction">
            <forward name="mediaListView" path="/adminPage.jsp"/>
        </action>
        <action input="/adminPage.jsp" name="SortListActionForm" path="/sortList" scope="request" type="actions.SortListAction" validate="true">
            <forward name="sortList" path="/adminPage.jsp"/>
        </action>
       
        <!--action path="/Welcome" forward="/welcomeStruts.jsp"/-->
    </action-mappings>
    
    <controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>

    <message-resources parameter="com/myapp/struts/ApplicationResource"/>    
    
    <!-- ========================= Tiles plugin ===============================-->
    <!--
    This plugin initialize Tiles definition factory. This later can takes some
    parameters explained here after. The plugin first read parameters from
    web.xml, thenoverload them with parameters defined here. All parameters
    are optional.
    The plugin should be declared in each struts-config file.
    - definitions-config: (optional)
    Specify configuration file names. There can be several comma
    separated file names (default: ?? )
    - moduleAware: (optional - struts1.1)
    Specify if the Tiles definition factory is module aware. If true
    (default), there will be one factory for each Struts module.
    If false, there will be one common factory for all module. In this
    later case, it is still needed to declare one plugin per module.
    The factory will be initialized with parameters found in the first
    initialized plugin (generally the one associated with the default
    module).
    true : One factory per module. (default)
    false : one single shared factory for all modules
    - definitions-parser-validate: (optional)
    Specify if xml parser should validate the Tiles configuration file.
    true : validate. DTD should be specified in file header (default)
    false : no validation

    Paths found in Tiles definitions are relative to the main context.
    -->
    <plug-in className="org.apache.struts.tiles.TilesPlugin" >
        <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" />      
        <set-property property="moduleAware" value="true" />
    </plug-in>
    
    <!-- ========================= Validator plugin ================================= -->
    <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
        <set-property
            property="pathnames"
            value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
    </plug-in>
  
</struts-config>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to