struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Valery Jacot <vja...@eim.ch>
Subject RE: Parameters to Actions
Date Mon, 07 Jul 2003 12:00:34 GMT
When you pass a parameter like you did in your url, use the method
getParameter() of the request...
It will return you a string...

And if you don't want to have a NullPointerException, do your if like this :
	
	String action = request.getParameter("action");
	if("confirmDelete".equals(action)){}

Bye..

-----Original Message-----
From: José Moreira [mailto:jmoreira@e-terno.net]
Sent: lundi, 7. juillet 2003 13:51
To: Struts Users Mailing List
Subject: Parameters to Actions


Hello, i'm using this dynamic link to pass a parameters to an action:

http://localhost:8081/deleteEvent.do?action=confirmDelete

* code in deleteEventAction :

        try {
            
            String action = (String) request.getAttribute("action");
            
            if (action.equals("confirmDelete")) {
                
                request.setAttribute("action",action);
                
            }
            
        } catch (NullPointerException e) {
            
            
            System.err.println("attribute action onot found");
        }


but i get an NullPointerException :(


* Action mapping :

<action path="/deleteEvent"
type="org.jcrontab.web.struts.DeleteEventAction" />


what can be the problem ?


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


***********************************************************************************

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager to postmaster@eim.ch

***********************************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message