This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts2Jquery <sj:submit> Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2Jquery <sj:submit>" Watch "Struts2Jquery <sj:submit>" New topic
Author

Struts2Jquery <sj:submit>

James Peter
Ranch Hand

Joined: Sep 15, 2010
Posts: 115
Hi All,

I have below queries.

1. How can I create a cancel/reset button using Struts2Jquery plugin?
2. If I use <sj:submit> then below html is getting generated.



If I create any element after <sj:submit> then it is getting displayed under submit button. I want it to be displayed just adjacent to submit button. Which is the best place/approach to modify this default behavior?

Please advice.

Rgds
Peter
Jesus Mireles
Ranch Hand

Joined: Mar 10, 2010
Posts: 122

1) I dont think there is a cancel/reset tag with the jquery plugin. I think you have to create it yourself
2) You probably need to change your theme to simple and you will need to handle the creation of the div tags and styles ... from the code you posted it looks like you have the xhtml theme on which is the default

James Peter
Ranch Hand

Joined: Sep 15, 2010
Posts: 115
Hi,

thanks for the suggestion.

1. I try to use struts reset button.

2. "handle the creation of the div tags and styles". Please provide some more details how to handle div tags.

I see many ftl files in simple theme. I am not sure which files I need to modify.

When I change my theme to simple I cannot see any labels which are visible in xhtml theme .


Rgds
Peter
Jesus Mireles
Ranch Hand

Joined: Mar 10, 2010
Posts: 122

You dont see the labels because like I said you have to handle the div and styles yourself. All I'm saying is that you need to write the HTML yourself if you use simple theme. However you get to more easily IMO control the look and feel of how the html gets rendered. On the other hand I think (im not 100% sure) that you can specify simple theme on a tag by tag basis which will let you put a reset button next to your submit button.
James Peter
Ranch Hand

Joined: Sep 15, 2010
Posts: 115
Hi,

I tried to apply theme to each input in the form.

I found a theme option for <s:textfield> but could not find the same for <sj:select> and <sj:submit>.

Both are having attribute template directory and template. So I modified them as below.



then i got error

I created subfolder under KUTheme and placed select.ftl in that. Still same error.

I am not sure what should be the correct file and folder for template and teplateDir. and also what file should be pointed to template attribute.

Please advice.

Rgds
Peter
Jesus Mireles
Ranch Hand

Joined: Mar 10, 2010
Posts: 122

Well I looked at the supported attributes and it doesnt have theme attribute. So just download the source and modify it or stop using this plugin ... Maybe submit a request to update it to support theme ... If I was in your shoes I'd be using simple theme throught the application so I'd put that in the struts.xml. If whatever you are trying to do wasnt solved by doing that then I'd modify the plugin code/compile and deploy my own version ....

-LM
Johannes Geppert
Ranch Hand

Joined: Jan 12, 2010
Posts: 67
you can simple create your own theme which includes the jquery freemarker templates.


My Java and Webprogramming Blog
James Peter
Ranch Hand

Joined: Sep 15, 2010
Posts: 115
Hi,

thanks for reply. I will follow your advice.


Rgds
Peter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts2Jquery <sj:submit>
 
Similar Threads
struts2jquery form submission (how to stop)
Struts2Jquery
Struts2Jquery form submitting twice.
struts2jquery - Stopping form submission
Struts2Jquery anchor tag