File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes problem with blockUI implementation and struts2-jquery-plugin Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "problem with blockUI implementation and struts2-jquery-plugin" Watch "problem with blockUI implementation and struts2-jquery-plugin" New topic
Author

problem with blockUI implementation and struts2-jquery-plugin

Armin Vetek
Greenhorn

Joined: Aug 21, 2010
Posts: 29
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


http://www.javanus.com/blogs
Johannes Geppert
Ranch Hand

Joined: Jan 12, 2010
Posts: 67
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


My Java and Webprogramming Blog
Armin Vetek
Greenhorn

Joined: Aug 21, 2010
Posts: 29
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

Joined: Aug 21, 2010
Posts: 29
Solved in another post.

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

Best regards,
Javanus
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with blockUI implementation and struts2-jquery-plugin