1

I have a web application for taking audits. Everything works fine except for one action. The JSP form for entering the users and location for each audit assigned is not submitted

It works without a flaw when executed from the Firefox browser in my Windows7 machine (in safe mode, too). When using the other machines or other browsers (Google Chrome) in my machine, the action doesn't execute instead just redirects. I put a breakpoint in eclipse for that specific method and found that it is not hit unless accessed from my Windows7/Firefox.

Could there be any possible reason for this behaviour? How can I fix it?

Source:

audit.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="com.hereafter.audit.ui.servlet" namespace="/audit"
    extends="struts-default,json-default">

....

    <action name="*Audit" class="com.hereafter.audit.ui.servlet.AuditAction" method="{1}">      
        <result name="success" type="redirectAction">               
            <param name="actionName">jspAudit</param>
            <param name="namespace">/audit</param>
        </result>
        <result name="message">/audit/pages/template/Message.jsp</result>
    </action>

....

</package>
</struts>

AssignAudit.jsp

<%@ taglib prefix="s" uri="/struts-tags"%>


    <form id="AuditAssignForm" action="assignAudit.action" method="post">
        <div >
            <h5>Instruction Details</h5>
            <label>Users :</label>
            <s:select id="user-multiselect" name="assignment.userList"
                cssClass="input-xlarge" multiple="multiple" list="userList"
                listKey="userID" listValue="userName"></s:select>                

            <label>Start Time :</label>
            <div id="datetimeStartTime" class="input-append date">
                <input data-format="dd/MM/yyyy hh:mm:ss"
                    name="assignment.scheduleInformation.timeStart" type="text"
                    class="input-large"></input> <span class="add-on"> <i
                    data-time-icon="icon-time" data-date-icon="icon-calendar"> </i>
                </span>
            </div>

            <label>End Time</label>
            <div id="datetimeEndTime" class="input-append date">
                <input data-format="dd/MM/yyyy hh:mm:ss"
                    name="assignment.scheduleInformation.timeEnd" type="text"
                    class="input-large"></input> <span class="add-on"> <i
                    data-time-icon="icon-time" data-date-icon="icon-calendar"> </i>
                </span>
            </div>

            <label>Events</label>
            <s:select id="event-drop-down" cssClass="input-xlarge"
                list="eventList" listKey="eventID" listValue="eventName"></s:select>
            <label>Audit Type</label> <select name="assignment.auditType">
                <option value="LIVE">LIVE VIEW</option>
                <option value="RECORDED">RECORDED</option>
            </select>


            <div>
                <button id="assign-audit-button" class="btn btn-primary"
                    type="submit">
                    <i class="icon-save"></i> Save
                </button>
                <a href="#myModal" data-toggle="modal" class="btn">Cancel</a>
                <div class="btn-group"></div>
            </div>
        </div>
        <div class="block span6">
            <div class="block-heading">
                <a>Locations</a>
            </div>
            <div class="block-body"
                style="min-height: 250px; height: 350px; overflow: auto;">
                <div id="location-tree"></div>
                <div class="clearfix"></div>
            </div>
        </div>
        <s:hidden name="audit.id"></s:hidden>
    </form>
</div>

Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243

2 Answers2

0

If it works in your browser, but it doesn't work in other browsers, and it doesn't work in any browser in other machines, including the one that works in your, then it must be browser-settings related. Check carefully the network/proxy settings of your Chrome, and try applying them to another browser in your machine.

If it doesn't work, 1) enable devMode and look for exceptions or error messages, and 2) check the network communication with Chrome DevTools, then compare the request sent (headers, parameters) with the one sent with a browser not working, eg Firefox with Firefox DevTools or Firebug.

Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243
0

The reason that the form doesn't work is because it didn't map properly to the Struts action.

You can use s:form tag and check if it hits the action.

It would probably hurt your design, but you can try a simple theme on the form:

<s:form id="AuditAssignForm" namespace="/audit" action="assignAudit" method="POST" theme="simple">
Roman C
  • 49,761
  • 33
  • 66
  • 176