Dean,
        By default, the <tiles:importAttribute> tag imports all of the Tiles
context         attributes into the page context:<tiles:importAttribute/>
        Any and all attributes stored in the current Tiles context would now
be available    through the standard page context.

      The situation with your jsp is that we gotto get the "action" from the
pageContext into your html:form tag. JSTL can help us in it provided you use
the html-el tags which will support expressions. So may be this can help
you.

      <tiles:importAttribute />  
        <html-el:form method="post" action="${pageContext.action}">

Or at the worst with simple html:form tags:

      <tiles:importAttribute />  
        <%String act = pageContext.getAttribute("action")%>     
        <%-- the code below will dump your action. Just to make sure .
Remove it later--%>
        <%=out.println( pageContext.getAttribute("action") ) %>
        <html:form method="post" action="<%=act%>">

The second one would surely work, but it may better using tags instead.


Hope this solves the problem.

Avinash


-----Original Message-----
From: Dean A. Hoover [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 29, 2004 5:10 PM
To: Struts Users Mailing List
Subject: Re: string substitution in tiles


Avinash Gangadharan wrote:

>If you are using the bean-el tag it should have worked.
>
Sorry, I am still learning struts and don't know what bean-el is. I am using
struts 1.1, is bean-el in there someplace?

>
>In any case this should work too :
>
><tiles:importAttribute />
><html:form method="post" action="<%=action%>">
>
Tried it and it failed. Did what you showed above and
also what you specified in tiles-defs.xml. Here's a bit of the
exception:

2004-03-29 20:03:43 ERROR Compiler.java:414 - Error compiling file: 
/usr/local/j
akarta-tomcat-5.0.19/work/Catalina/localhost/_//org/apache/jsp/WEB_002dINF/t
iles
/layouts/FormLayout_jsp.java     [javac] Compiling 1 source file

/usr/local/jakarta-tomcat-5.0.19/work/Catalina/localhost/_/org/apache/jsp/WE
B_00
2dINF/tiles/layouts/FormLayout_jsp.java:229: cannot resolve symbol symbol  :
variable action
location: class org.apache.jsp.WEB_002dINF.tiles.layouts.FormLayout_jsp
      _jspx_th_html_form_0.setAction( action );
                                      ^
1 error

>
>
>
>
>
>
>-----Original Message-----
>From: Dean A. Hoover [mailto:[EMAIL PROTECTED]
>Sent: Monday, March 29, 2004 2:21 PM
>To: Struts Users Mailing List
>Subject: Re: string substitution in tiles
>
>
>No, that doesn't work. I get an exception and look in
>the log and see:
>
>2004-03-29 17:15:07 DEBUG InsertTag.java:945 - [ServletException
>in:/WEB-INF/tiles/layouts/FormLayout.jsp] Cannot retrieve mapping for 
>action /<bean:write name="action"/>'
>
>any other ideas?
>
>Dean Hoover
>
>Avinash Gangadharan wrote:
>
>  
>
>>Try this :
>>
>>In tiles-def.xml --- <put name="action" value="Logon.do" />
>>
>>In your jsp  ---
>><tiles:importAttribute />
>><html:form method="post" action='<bean:write name="action"/>'>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>-----Original Message-----
>>From: Dean A. Hoover [mailto:[EMAIL PROTECTED]
>>Sent: Monday, March 29, 2004 1:40 PM
>>To: [EMAIL PROTECTED]
>>Subject: string substitution in tiles
>>
>>
>>I have a general form layout I am defining in
>>tiles. But there is one thing I'm not sure how
>>to do. The relevant part of the form layout
>>looks like this:
>>
>><td valign="top">
>><html:form method="post" action="xxx">
>><table cellpadding="0" cellspacing="0" width="100%">
>><tr>
>><td>
>><table cellpadding="0" cellspacing="0" width="100%">
>><tr>
>><td><els:spacer width="150"/></td>
>><td><els:spacer width="250"/></td>
>></tr>
>><tiles:get name="subForm"/>
>></table>
>></td>
>></tr>
>><tr>
>><td>
>><tiles:get name="buttons"/>
>></td>
>></tr>
>></table>
>></html:form>
>></td>
>>
>>
>>I want to replace the xxx action with a string
>>I define in tiles-defs.xml. Say I want to call the replacement string 
>>"url" and in one instance I want it to be "/Logon.do". What does the 
>>put look like in tiles-defs.xml and how can I modify
>>the JSP snippet shown above to do the appropriate
>>replacement (for action="xxx")?
>>
>>Thanks.
>>Dean Hoover
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>> 
>>
>>    
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to