File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Div in struts 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Div in struts 2" Watch "Div in struts 2" New topic

Div in struts 2

rahulJ james
Ranch Hand

Joined: Oct 03, 2008
Posts: 123
I have 3 different jsps 1 for display, 1 for success and 1 for failure..

So Is there anyway I can use the <div tag in struts 2 and can have a single jsp and can make the others hide..

Please advise
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
you can use s:if tags to control if the style of each div is display:inline or display:none. The s:if tag can make its decision based on a property you set in your action class to indicate which div is to be displayed. If you do it this way I think you'll only have one result for your action in your struts.xml file.

If you'd rather have your struts.xml file control this then you can define 3 results and set a param for each result to indicate which div to display. I've only used params in my struts.xml file for redirectActions but I would think they should also work for JSPs. Your param should get set as an attribute in your request object. I don't thing its part of the OGNL stack for your jsp you'll either need to push the param on to your stack in the jsp or use OGNL to access your request attributes (and I haven't figured out how to get access to the request object through OGNL)
I agree. Here's the link:
subject: Div in struts 2
It's not a secret anymore!