2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Airshow
0

At the risk of revealing my gross ignorance about struts, here's my best guess ...

Struts will forward either to a unique URL or to a more general URL with some query string in the path to indicate the required action.

If the page is unique (action is not determined by a quesrystring appended to the path) then there's most probably no need to pass the struts action class to javascript. It is implicit by the fact that that particular page has been served (containing whatever HTML/javascript as necessary).

If the page is not unique (action is determined by a quesrystring appended to the path) then you can do one of two things:

  1. Get javascript to read the action from the querystring. See my Query Parser for a way to do this. This is possible only if the page is served with eg. actionclass=... in the querystring.
  2. Write the action into javascript with JSP/PHP. Here is a PHP example:
    <?php
    $actionClass = $_GET('actionClass');//sanitized as necessary to prevent code injection (though struts may immunize you from that).
    ?>
    <script>
    ...
    var actionClass = <?php =$actionClass ?>;
    ...
    </script>

    I dare say it's similar in JSP if that's what you are using.

Airshow

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.