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 Struts1.3 tiles problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts1.3 tiles problem" Watch "Struts1.3 tiles problem" New topic
Author

Struts1.3 tiles problem

mahesh shinde
Ranch Hand

Joined: Jul 24, 2009
Posts: 69

I am developing application using struts1.3.10

when I forward to tiles mapping I get the message Page cannot found error

I have included the struts-tiles-1.3.10.jar

strutsConfig.xml


Web.xml


tilesdefs.xml


appreciate your help
mahesh shinde
Ranch Hand

Joined: Jul 24, 2009
Posts: 69

Am I using outdated framework
But you use it before Struts2
So any hint
Please tell me if you need any other information to solve it
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

mahesh try with adding module awareness in struts-config as below and try it.



If that doesnt help, post the actual error stackstrace and when exactly you are getting this problem. Also post the Layout.jsp (header part, i hope you are including the taglib there)
Additionally, you should also include the tiles tag lib in your deployment descriptor



Have Fun with Java
little,little.. little by little makes a lot..
mahesh shinde
Ranch Hand

Joined: Jul 24, 2009
Posts: 69

hey shankar thanks for the reply.
My configuration is exactly as you suggest.

(header part, i hope you are including the taglib there)
Additionally, you should also include the tiles tag lib in your deployment descriptor


yes I included both at the places you mention.
The error I got is Page not found Error.

I will try your ModuleAware suggestion.I will paste my Layout.jsp.
Thanks again for your reply.
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

May be there is some other problem? somthing is missed..
Just try removing the tiles part and forward directly to the JSP and see if it works?
mahesh shinde
Ranch Hand

Joined: Jul 24, 2009
Posts: 69

No lucky with previous one
So I created one sample project.
Strusts-config entry


my userform.jsp is like


and tiles-defs.xml

and commonlayout.jsp

now I can see the userform.jsp with only the body part of my tiles
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

Mahesh,
If I am right, userform is the final JSP (the body)? You need not use the tiles in your userform.jsp.
Try something like below and let us know what is happening

in Struts-config



in tiles-def



in commonlazout.jsp


Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

Also keep an eye on scroll bar... since we have not mentioned the tile height and width the jsps may overlap or painted one after the other...
zou can do that by having the tile inserted in div with a style, for example



mahesh shinde
Ranch Hand

Joined: Jul 24, 2009
Posts: 69

thanks for your prompt response shanker.I will try
mahesh shinde
Ranch Hand

Joined: Jul 24, 2009
Posts: 69

When I use this


in struts-config

the same 404 eror
what it means exactly, its not found the tile definition
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

extremely sorry for the slash its not "/userformjsp", try just "userformjsp" in struts config

The path in struts forward means that it is going to look for the definition in the tiles else if any path is provided then it would directly consider that JSP. Say for example you have header, body and footer in all UI pages but not in logout page. Then for the logout forward can directly pointed to the logout.jsp which doent need tiles. However, it doesnt do it everytime. At the time of server start up, as part of deployment process of struts it creates objects designed based on struts-config and tiles-def coupling them. Try removing the struts-config from your war after server start up and see what happens. it explains the story... You were getting 404 Err since it considered the realtive path and ther is no such file
What does it mean extending a layout in tiles? In the above example, for most of the JSP's you would have the same layout and style definitions and it is unnecessary to mention for each forward about the header, footer right menu etc.. instead you can simple define one and reuse it by extending it and replacing whatever tile attribute you want. In this case your body JSP
mahesh shinde
Ranch Hand

Joined: Jul 24, 2009
Posts: 69

thanks for followup
I have tried "userformjsp" this But I get the error to include the "/"
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

same here

You should still have this in struts config... do you have it?


Else i shall create a new project and see whats exactly happening, we shall be in the same page
mahesh shinde
Ranch Hand

Joined: Jul 24, 2009
Posts: 69

yes I have it in struts-config
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

Some time, just downloaded the example
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

Finally, i downloaded the struts1.3.10 sample (the blank one) which you were using earlier and modified it to configure tiles and it works fine (tiled)

The steps are as below

Made our JSPs ready (all JSPs are in pages folder itself)

commonlayout.jsp

footer.jsp

header.jsp

The same Welcome.jsp given in the blank example, no change..

web.xml

just added file named tiles-defs.xml just in the WEB-INF directory with exact content

tiles-defs.xml

Activated tiles in struts-config.xml


lib directory of WEB-INF has only the downloaded jar namely

  • struts-core-1.3.10.jar
  • struts-taglib-1.3.10.jar
  • struts-tiles-1.3.10.jar
  • antlr-2.7.2.jar
  • commons-beanutils-1.8.0.jar
  • commons-chain-1.2.jar
  • commons-digester-1.8.jar
  • commons-logging-1.0.4.jar
  • commons-validator-1.3.1.jar
  • oro-2.0.8.jar


  • Thats it, no more magic... it worked, i hope this time it will works for you as well,
    mahesh shinde
    Ranch Hand

    Joined: Jul 24, 2009
    Posts: 69

    Hey shanker Many Many thanks for your help.
    finally we got working code.
    Definately I will try this evening with blank sample and the Jar's you suggested .
    Thanks Again
    mahesh shinde
    Ranch Hand

    Joined: Jul 24, 2009
    Posts: 69


    This time this celebration is for me because it works for me
    I am very very happy
    the problem is in DTD declaration
    it should be


    mine was 1.3
    Thanks Shankar
    stephan babu
    Greenhorn

    Joined: Apr 23, 2012
    Posts: 13
    Please any one solve my problem with tiles,

    I am having struts-config.xml and i have created one more struts-config-permit.xml,

    and i am having tiles-defs.xml,

    i have plug in that tiles-defs.xml in both the struts-config.xml and struts-config-permit.xml.

    In struts-config.xml the tiles definition is called properly, but in struts-config-permit.xml its not working, it telling the error like,

    Path permitPage does not start with a "/" character


    details...
    -------------


    Posts: 3

    [Post New]posted Today 12:59:30 PM
    Quote Edit
    in my project,

    i have 2 struts config xml files.

    i have 1 tiles-defs.xml file

    i have plugin this tiles-defs.xml in both stuts-config.xml and struts-config-permits.xml files like below,
    ----------------------------------------------------------------------------------------------
    <plug-in className="org.apache.struts.tiles.TilesPlugin" >
    <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" />
    <set-property property="moduleAware" value="true" />
    </plug-in>



    im my tiles-def.xml i codel like below,
    ------------------------------------------------------------------------------------------------
    <definition name="mainPage" path="/mainTemplate.jsp">
    <put name="title" value="Excise"/>
    <put name="header" value="/header.jsp"/>
    <put name="menu" value="/menu2.jsp"/>
    <put name="content" value="/content.jsp"/>
    <put name="footer" value="/alert.jsp"/>
    </definition>

    <definition name="permitPage" extends="mainPage">
    <put name="content" value="/pc_permit_appli_frm.jsp"/>
    </definition>


    in my stuts-config-permit.xml i coded like below,
    ------------------------------------------------------------------------------------------------
    <action path="/PermitAppliData" name="PermitMasterForm" scope="request" validate="true" type="nic.puduvaicalal.permits.PermitAction" input="/permits/pc_permit_appli_frm.jsp">
    <forward name="data" path="permitPage" />
    </action>


    when i am caling the url "switch.do?prefix=/permits&page=/PermitAppliData.do" by click the menu i found the error below,
    --------------------------------------------------------------------------------------------------------

    java.lang.IllegalArgumentException: Path permitPage does not start with a "/" character
    org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:107)
    org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:96)
    org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:54)
    org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)


    please anyone solve my problem..
     
    It is sorta covered in the JavaRanch Style Guide.
     
    subject: Struts1.3 tiles problem