aspose file tools*
The moose likes Struts and the fly likes template:insert  problem/issue.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "template:insert  problem/issue...." Watch "template:insert  problem/issue...." New topic
Author

template:insert problem/issue....

Chad Smith
Greenhorn

Joined: Apr 02, 2004
Posts: 2
I'm using the <template:insert> struts tag in my .jsp files....similar to this
<table width="800">
<tr>
<td class="menu"><tmp:insert template="header.jsp"> </tmp:insert></td>
</tr>
</table>
I'd like to be able to configure the value of template (in this case "header.jsp" in the struts-config.xml.....
Here's what I've done so far....
1) extended ActionMapping and added getters/setters for new parameters
2) set these in the struts-config.xml file using the <set-property value="header.jsp" property="header"/> ect....
3) in my action class I put these into the request
4) in my .jsp I pull them out using <% String header = (String)request.getParameter("header");
5) use that value like so: <tmp:insert template="<%= header %>">
This works.....but I have two problems with it.
1) I don't like using <% %> or <%= %> in my .jps files....my ui people just don't seem to get it....
2) In every one of my action.execute() I have to pull my variables out of the ActionMapping and put them into the request...i can't seem to find an efficient way to only write that code once....
I've tried putting my extended ActionMapping into the request and using <bean:write> but that doesn't work because I can't nest struts tags like so...
<tmp:insert template="<bean:write name="mapping" property="header">"/>

has anyone figured out a way or have any ideas on how to get a value from my struts-config.xml into my <tmp:insert template="value from xml file"> tag in my jsp?....
Chad Smith
Greenhorn

Joined: Apr 02, 2004
Posts: 2
.......and why can I only add one query parameter to the url in my path in the action-mappings of the struts-config.xml?
for example:
This works:

<action path = "/public/mypage"
type = "org.myorg.action.MyPageAction"
name = "myForm"
scope = "request"
validate = "false"

>
<forward name="mypage" path="/myPage.jsp?var1=value1" />
</action>
but this doesn't:
<action path = "/public/mypage"
type = "org.myorg.action.MyPageAction"
name = "myForm"
scope = "request"
validate = "false"

>
<forward name="mypage" path="/myPage.jsp?var1=value1&var2=value2" />
</action>

I get an exception thrown telling me I need to delimit 'var2' with ';'
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: template:insert problem/issue....