• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with blockUI implementation and struts2-jquery-plugin

 
Armin Vetek
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I would like to block UI when the submit button is pressed. I would like to implement the following functionality: user click the submit button and the user interface is blocked after that, a loading image is displayed. User is redirected to a new screen when the struts2 action has finished the work.

I have tested jquery.blockUI.js and the user interface is blocked but I have a problem with integration of blockUI and struts2-jquery-plugin.

I am using struts2-jquery-plugin. Below are the fragments from my jsp page. When I press the Save button (sj:submit) the alert window called from java script is displayed but the blockUI does not work. If I add <script type="text/javascript" src="jquery-1.3.2.js"></script> and <script type="text/javascript" src="jquery.blockUI.js"></script> then jquery is not working anymore-when I press the save button javascript function before is not triggered.

<!--enable jquery-->
<sj:head jqueryui="true"/>

<script type="text/javascript">
$.subscribe('before', function(event,data) {
alert("before");
$.blockUI({ message: '<h1>Sumitting your request..</h1>' });
$.blockUI('<h1>Shranjujem podatke...</h1>');
});
</script>

<s:form action="RequestAction" theme="xhtml" >
<sj:submit
id="save"
name="save"
targets="result"
button="true"
value="Save"
indicator="indicator"
onBeforeTopics="before"
onCompleteTopics="complete"
/>
</s:form>

Best regards,
Javanus
 
Johannes Geppert
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
don't add jquery-1.3.2.js to your jsp, jquery is already included with <sj:head> tag.
just place

<script type="text/javascript" src="jquery.blockUI.js"></script>

after the <sj:head> tag

Johannes
 
Armin Vetek
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I tried to use the proposal but ui blocking still does not work.

I have prepared an example. You can downloaded the netbeans project at http://www.javanus.com/jQueryBlockUI.zip . Netbeans project is configured for the glassfish application server at the moment.

The project consists from two pages. If you press submit button on index.jsp page than the long action will be launched (for loop 50k). I would like to put uiblock to this page. How can I achieve this?

I also add a backup,jsp page. Try to click submit button on a backup.jsp page and you will get the animated gif. The animated gif should be presented when the user clicks on a long action button.

Best regards
 
Armin Vetek
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Solved in another post.

http://www.coderanch.com/t/516223/Struts/pass-value-struts-form-javascript

Best regards,
Javanus
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic