Reputation: 1487
I have got a basic question regarding Struts2. I want to implement a simple web application in the next style:
TITLE 12:42
------------------------------------------------------
MENU | **********************************
1. Config | **********************************
- Products | **********************************
- Customers | **********************************
2. Operations | **********************************
- ... | **********************************
3. Statistics | **********************************
Please forgive me, I am not a web designer. :)
So my web application has got a title and additional information (e.g. current time) will be put on the header part. On the left side there will be a menu and on the right side (which will occupy the 80% of the display) will appear a page (I indicated it with the many stars) depending which menu has been choosen on the right. After login the right side will be empty and if the user clicks on a menu the specific page appears there.
I would like to use Struts2 to control the page flows.
Could you please give me some idea how to start?
Thanks, V.
Upvotes: 0
Views: 2411
Reputation: 746
I strongly recommand you to use Sitemesh as a template generator, very useful
Upvotes: 0
Reputation: 1487
My solution in the end:
index.jsp
<body>
<table border="0">
<tr>
<td colspan="2"><s:include value="header.jspf"/></td>
</tr>
<tr>
<td><s:include value="menu.jspf"/></td>
<td><s:include value="%{page}"/></td>
</tr>
</table>
</body>
struts.xml
<package name="menu" extends="struts-default">
<action name="menu_admin_freq" class="org.vhorvath.throttling.web.actions.MenuAdminFrequencyAction">
<result name="SUCCESS">/jsp/index.jsp</result>
</action>
</package>
Action class
public class MenuAdminFrequencyAction extends ParentAction {
private String page;
public String getPage() {
return page;
}
public String execute() {
page = "/jsp/frequency.jspf";
return "SUCCESS";
}
}
Menu.jspf
<table border="0">
<tr>
<td><b>Administration</b></td>
</tr>
<tr>
<td align="left"><a href="menu_admin_freq.action">Frequency of ...</a></td>
</tr>
</table>
Upvotes: 0
Reputation: 23587
Well this is most likely a question related to design and layout control and you have few good options here
you can create an application frame or master template which can define following sections
in above all of sections can be predefined except working area which can be changed at run time by sending view based on your application logic.
for me Tiles is a good way to go and it will do many things for you in a easy and flexible way.
Upvotes: 1