Getting the result from struts.xml by using javascript

Go To


I want to get the result in struts.xml by using javascript or jquery. For example I have these results in my struts.xml,

        <result name="input">error.jsp</result>
        <result name="syserror">error.jsp</result>
        <result name="login">loginError.jsp</result>
        <result name="error">error.jsp</result>

I would like to know how to get the result name using javascript. I need to detect the return of struts.xml .

2012-04-04 03:33
by Inah


My experience with Struts is somewhat limited, but...

"struts.xml" is a Struts configuration file. I can't imagine any default functionality that is going to send the contents of that file to the browser. There is simply no reason for it (that I am aware of).

Also, I would think that this is the sort of information that you would not want to have publicly available to anyone who decides to look at your page's source code. You'd be providing some insight into the organization of your application that wouldn't otherwise be available to the public.

However, if you really must do this, the solution probably lies in creating a server-side resource of some sort (JSP, PHP, whatever) that can respond to an AJAX request with the contents of this file. From there you can easily parse it via E4X.

But again, I really don't think this is an especially good idea.

2012-04-11 17:03
by Bob FiveThousand