[ANN] Struts Plugin V0.3: Tiles integration

I'm proud to announce the first version with support for Tiles!

- GoToDeclaration in struts-config.xml: treat all attribute values starting with "/" as possible navigation targets (e.g. paths to config files)

- Tiles integration: automatically scan all tiles-defs files configured in struts-config.xml; multiple files must be separated by ","

- GotoDeclaration in struts-config.xml: support for Tiles definitions in forwards, open corresponding tiles-defs file and jump to definition

- GotoDeclaration in tiles-defs.xml: open referenced web resource in editor

- GotoDeclaration in tiles-defs.xml: jump to parent definition (..extends="parentDefinitionName")

- InvalidForwardResourceInspection: verify forward paths in struts-config.xml (including Tiles definition names if applicable)

- Bugfix: IsNotSubClassOfActionInspection should not inspect "type"-attribute of nested "exception"-element

Finally struts-config.xml and tiles-defs.xml got to marry each other ;)

http://www.intellij.org/twiki/bin/view/Main/StrutsPluginDevelopment

Looking forward to your feedback and suggestions!

Enjoy,

Yann

20 comments
Comment actions Permalink

thanks, cool plugin.

why is "success" mandatory? several of my actions don't have one where it doesn't make sence.. but one example that most folks might have is something like:

also I have a forward on another actions like: ]]>

where /do/* is the struts servlet mapping.. but it is marked as "cannot resolve forward"

the plugin can't find my tiles config files because our project layout is a bit off and they don't actually end up in the correct spot until deployment (they live in a config/ hierarchy instead of the web/WEB-INF hierarchy until build/deployment).. could you do like IDEA does with resources, such that we can map a file in the project to an unknown file path in the config?

0
Comment actions Permalink

Dan,

thanks for for your feedback.

why is "success" mandatory? several of my actions don't have one where it doesn't make sence
I agree, sometimes there's no default forward, e.g. when creating PDFs from an Action (actually, this situation could be checked in the inspection by verifying a "return null" in the corresponding Action). You can turn off the check for a mandatory forward separately in the corresponding inspection setting.

+ + will check back on this +also I have a forward on another actions like: ]]>

where /do/* is the struts servlet mapping.. but it is marked as "cannot resolve forward"
+
well this one is tricky (but on my TODO list ;) ), because I'd have to resolve web.xml-files and find all (Action)Servlet-instances and their mappings to be able to resolve forwards to servlets/Action-paths.

could you do like IDEA does with resources, such that we can map a file in the project to an unknown file path in the config?
Please try mapping the directory where your tiles-defs is located as additional web resource path in webmodule-settings and see if it works (my plugin scans all defined web resource folders). But I think your proposal to manually define (additional) locations is a good idea to suit all exotic setups.

Cheers,
Yann

0
Comment actions Permalink

Hi,

regarding
+
]]>
+

a) I have added a check for ForwardAction, inspection will not trigger in this case (available in next version)
b) alternatively, you can use this syntax (which is also shorter):

]]>


Greetings,

Yann

0
Comment actions Permalink

oh, wow... thanks for the syntax update.. i can't believe I never noticed that... i'm going to change all of those over.

0
Comment actions Permalink

My tile references don't seem to be resolving properly.

My project (part of a multiple-module project) is laid out as so:

/web
/jsp
/WEB-INF

  • struts-config.xml

  • tiles-defs.xml

/register

  • struts-config.xml

  • tiles-defs.xml


My root struts-config has this entry for tiles:

And an example action where the error is reported (as all forwards are, even those pointing to valid strut actions or jsps): ]]>

Otherwise, I love this plugin -- thank you for your work.

~Keith

0
Comment actions Permalink

it's working much better now. thanks for the help.

forwards that refer to tile defs are not resolving at this point. is that a config issue on my end?

+well this one is tricky (but on my TODO list ;) ), because I'd have to resolve web.xml-files and find all (Action)Servlet-instances and their mappings to be able to resolve forwards to servlets/Action-paths.
+

for the short term, could you add a way to ignore certain path prefixes?

0
Comment actions Permalink

should GotoDeclaration be working for me across tile-def files? it works great within a single file.. but if one def extends a layout in defined in another file it doesn't go.

0
Comment actions Permalink

+forwards that refer to tile defs are not resolving at this point. is that a config issue on my end?
+

Most probably, please post more information:
- the snippet from your TilesPlugin declaration in struts-config.xml
- your tiles-defs.xml (first 10-15 lines)
- information about your project setup

Did you make sure, your tiles-defs is located under one of the configured web resource directories in project setup?

HTH,
Yann

0
Comment actions Permalink

Please try mapping "web" as web resource folder in your project setup and see if that works.

HTH,
Yann

0
Comment actions Permalink

+should GotoDeclaration be working for me across tile-def files? it works great within a single file.. but if one def extends a layout in defined in another file it doesn't go. +

not yet ;) this one is also a bit more tricky, because I'll have to search backwards from tiles-defs.xml -> using struts-config.xml -> find tile-definition in other files if not resolvable in current file. But this will be added shortly, stay tuned.

Cheers,
Yann

0
Comment actions Permalink

ups, forgot about this one:
+for the short term, could you add a way to ignore certain path prefixes? +

I'm 3/4 done on resolving ActionServlets in current web module and their corresponding ServletMappings to enable GotoDeclaration and InvalidForwardResource for these forwards (*.whatever (finished), /whatever/ (TODO) ) as well. Stay tuned for next release ;) (tomorrow?!)

POLL: Do you guys need to resolve to "normal" Servlets as well or are Action-paths enough?

Cheers,
Yann

0
Comment actions Permalink

for me, action paths are enough for now... but i'm sure some folks have a need for servlets as well..

0
Comment actions Permalink

my tiles-defs are now all under a web resources dir.

here is my tiles plugin def:

		
    	
    	
	
]]>


here is the top of my main tiles-def




	
		
		
		
  		
  		
  		
  		
 	
]]>


here is the snip from the sub tiles-def (admin-tiles-def.xml)




    
          
          
     

]]>



when i ctrl-b on extends="layout.rate.app"> it does nothing... where i would expect it to jump to the main tiles-def.xml

0
Comment actions Permalink

+when i ctrl-b on extends="layout.rate.app"> it does nothing... where i would expect it to jump to the main tiles-def.xml +

please see my response below (Posted: Aug 15, 2005 7:07 PM), jumping between tiles-defs-files is not supported yet. I guess it works for you from struts-config.xml -> tiles-defs.xml ??

0
Comment actions Permalink

Yann,

Thank you for your reply. My /jsp folder is already mapped as a resource folder. As it is the root web directory for the application, IDEA prevents me from including its parent as a web resource directory. As well it should -- my /jsp is where my web content lives, and the /web directory contains various artifacts I've no desire to be present in the application.


Keith

0
Comment actions Permalink

the only place i have any references to tile defs in my struts config are in forward definitions in actions.

]]>


and they show up as "unresolved" in all cases.

0
Comment actions Permalink

maybe this is because of the way i have things setup...

my tiles and struts config files are all in a dir called "/config" and my web module content root is "/web".. I have "/config" mapped to "WEB-INF/" as it's relative path to the deployment root in web resources. and "/web" mapped to "/"... when i copy all my config files to the tmp dir "/web/WEB-INF/" all my tile defs in forwards get resolved fine.

0
Comment actions Permalink

Ouch, I just found a bug regarding this which is already fixed for the next version.

Placing tiles-defs in an arbitrary config directory and mapping to /WEB-INF/ works in my test-project now.

Thanks for reporting!

Yann

0
Comment actions Permalink

Keith,

please try mapping /WEB-INF/ and /register/ separately and see if that works - it might not since I just discovered and fixed bug when mapping web resource directories using a different relative deployment path than "/" (try to map them to "/" if that works for your project setup), please wait for the next version then.

HTH,

Yann

0
Comment actions Permalink

great! thanks for fixing.

0

Please sign in to leave a comment.