Hello there! Your action should return a String like "list" or "success" or
just "something" and then in your struts.xml file, you should add a snippet
in your action for that string. Thus, the framework will be able to render
a result. Your action is returning null, and you haven't defined a result
either. In your action instead of
return null;
use
return "success";

And in your struts.xml inside your action add:

            <result name="success" type="dispatcher">
                <param name="location">/WEB-INF/jsp/admin.jsp</param>
            </result>



On Thu, Apr 19, 2012 at 1:01 PM, Rout, Biswajit <[email protected]>wrote:

> Hi All,
>
> If you will look into the below attached files, from the welcome page
> (index.jsp) it is going to admin.html (based on my struts.xml). Internally
> admin.html is calling admin.js and from my admin.js to fill combo box I am
> calling adminProcess.action. In that way I will be able to fill up the
> combo box.
>
> For this reason, intentionally my action method returning null.
>
> However, I am getting below exception
> No result defined for action com.xx.xxx.admin.action.AdminAction and
> result input
>
>
> Please find the list of files:
>
> Admin.js
>
>        var crudComboStore =  new Ext.data.JsonStore({
>                storeId: 'table_list',
>                proxy : {
>                        type :'ajax',
>                        url  : 'adminProcess.action',
>                        reader : {
>                                type :'json',
>                        root : 'crudData'
>                    }
>                },
>        fields : ['tablename', 'displayName']
>
>        });
>        crudComboStore.load();
>
>
> Index.jsp
>
> <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
>        pageEncoding="ISO-8859-1"%>
> <%@taglib uri="/struts-tags" prefix="s"%>
> <html>
> <head>
> <title>Admin Page</title>
> </head>
> <body>
> <h3>Admin Page</h3>
> <s:a href="jsonAction.action">
>        <FONT color="green">Go to Admin Page..</FONT>
> </s:a>
> </body>
> </html>
>
> admin.html
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "
> http://www.w3.org/TR/html4/strict.dtd";>
> <html>
> <head>
> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
> <title>Admin Page</title>
>
> <link rel="stylesheet" type="text/css"
>        href="extjs/resources/css/ext-all.css">
> <script type="text/javascript" src="extjs/bootstrap.js"></script>
> <script type="text/javascript" src="admin/admin.js"></script>
>
> </head>
> <body></body>
> </html>
>
> struts.xml
>
>                <action name="jsonAction"
> class="com.xx.xxx.admin.action.CRUDAction">
>                        <result>admin/admin.html</result>
>                </action>
>
>                <action name="adminProcess" method="getMasterTableList"
>                        class="com.xx.xxx.admin.action.AdminAction">
>                </action>
>
> My action method
>
>        public String getMasterTableList() {
>                System.out.println("AdminAction.getMasterTableList @@@@@");
>
>                List<CRUDSVO> objCRUDTableList = null;
>                Iterator<CRUDSVO> objItr = null;
>                CRUDSVO objCRUDSVO = null;
>
>                JSONObject interfaceObject = new JSONObject();
>                JSONArray interfaceArray = new JSONArray();
>                JSONObject finalInterfaceObject = new JSONObject();
>
>                try {
>                        //HttpServletResponse response =
> ServletActionContext.getResponse();
>                        objCRUDTableList = adminBo.getCRUDTableList();
>                        objItr = objCRUDTableList.iterator();
>                        while (objItr.hasNext()) {
>                                objCRUDSVO = null;
>                                objCRUDSVO = objItr.next();
>                                interfaceObject = new JSONObject();
>
>  interfaceObject.put(AdminConstants.TABLE_NAME, objCRUDSVO.getTableName());
>
>  interfaceObject.put(AdminConstants.DISPLAY_NAME,
> objCRUDSVO.gettableDisplayName());
>                                interfaceArray.put(interfaceObject);
>                        }
>                        finalInterfaceObject.put(AdminConstants.CRUD_DATA,
> interfaceArray);
>
>  response.getWriter().write(finalInterfaceObject.toString());
>                } catch (IOException e) {
>                        e.printStackTrace();
>                } catch (Exception ex) {
>                        ex.printStackTrace();
>                }
>                return null;
>        }
>
> Thanks in advance for helping me.
>
>
>
> Best regards,
> Biswajit
> Planned Vacation : From 2-July-2012 to 6-July-2012
>
>


-- 
Hernán

Reply via email to