This week's book / license giveaways are in the JDBC and Relational Databases and Java in General forums.
We're giving away four copies each of PostGIS in Action and Java Advanced Topics Training and have the authors on-line!
See this thread and this one for details.
The moose likes Struts and the fly likes Suggestion on templated page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Suggestion on templated page" Watch "Suggestion on templated page" New topic
Author

Suggestion on templated page

Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Hi, I have a search page which only had forms... I can include this page on any part of my JSP as I please because it doesn't generate any dynamic contenet. However, now I realized that I need to include dynamic content... For example, I need a html:select tag that would be poppulated based on the records on the database... But to do this, I need to come from the controller which would render my template, un-reusable in other parts of my page... I've thougt of different solutions, mainly...

1. Type all the option tags manually.
2. AJAX?
3. Maybe <jsp:include page="/actions/someactions.do"/> would work?
4. Maybe Struts has other alternatives to this problem...

I'm sure many of you have experienced this... I'm trying to remain as model 2 as possible... Thanks!


SCJP 1.5
http://devpinoy.org/blogs/lamia/ - http://everypesocounts.com/
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I vote for option 3. By having a jsp:include call a Struts action, you can populate the bean containing the list of options and then display the JSP fragment as part of a larger page.


Merrill
Consultant, Sima Solutions
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Hi Merrill. Thanks for your suggestion... But the page I'm trying to include won't get displayed... I even tried taking out all the Struts tags and just insert a plain text... But nothing would appear excep the page which is trying to include the template... Here's how I inlcude my page...

index.jsp



Here's the page I'm trying to include...



thanks for you help...
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Hmmm... After clearing all my cookies and offline contents... I found out that the page really just forwards to my included page and not really include it... OMG!!!
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Make sure the forward for your action does not specify redirect="true". It sounds like this may be what's happening.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Suggestion on templated page