PDA

View Full Version : Java Tiles with SpringFW


sree2007
Sep 11th, 2007, 10:15 PM
Hi,

In my current project , I need to develop a screen with Java Tiles, where the body contains two horizantal Tiles(tile1 and tile2). Each Tile has few buttons and each button click represents a new JSP page. The data for every button click, a JSP should be displayed on the same page(ie tile1). I'm also using
Java spring to control the navigation of pages internally .first half of
the screen displays data according to the first button(selected).2nd half of
the screen displays data accordingly the buttons selected.in both the cases
the whole page refreshes and content with buttons should be shown.


<definition name="view1" extends="template">
<put name="body1" value="/WEB-INF/jsp/tiles1.jsp"/>
<put name="body2" value="/WEB-INF/jsp/tiles2.jsp"/>
</definition>

<definition name="view2" extends="template">
<put name="body1" value="/WEB-INF/jsp/tiles3.jsp"/>
<put name="body2" value="/WEB-INF/jsp/tiles4.jsp"/>
</definition>

In the tiles-def.xml file presently my spring controller is returning a view with the definition name(view1/view2)according to the button clicked.

I'm looking for a solution where body1 and body2 will map to a jsp dynamically depending on the button clicked insted of mentioning jsp for each button.something like${body1}.

How to achieve it in Java Tiles? Does anyone have a sample code for this ?

pancara
Sep 12th, 2007, 03:43 PM
hi,

how if used the controller it put like this:

...
<put name="body1" value="controllerUrl.do"/>
...


so the view that should be rendered selected by controller.

sree2007
Sep 12th, 2007, 08:27 PM
Hi,

Thanks for the inputs.

I'm using a multiactioncontroller where each method return a view ---(with respect to the button clicked each method is written)

public ModelAndView
getDetails(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
return new ModelAndView(DETAILS,DETAILS,det);
}

public ModelAndView
getInfo(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
return new ModelAndView(Info,Info,info);
}


my tiles--def pts to(controller view is definition name and model info is passed to jsp to retrieve values)

<definition name="DETAILS" extends="template">
<put name="body1" value="/WEB-INF/jsp/view1.jsp"/>
<put name="body2" value="/WEB-INF/jsp/det.jsp"/>
</definition>

<definition name="Info" extends="template">
<put name="body1" value="/WEB-INF/jsp/view1.jsp"/>
<put name="body2" value="/WEB-INF/jsp/inst.jsp"/>
</definition>

......
Reminding the situation,

my content screen has been divided into 2 horizontal tiles and top body1 contans few tabs and body2 contains few tabs.

on clicking those tabs the view should be displayed.

for the first time the screen should show by default 1st button selected from both body1 and bosy2 and print the pages.

the problem I'm facing is,
my body1 page is displayed as i have to click a link in the prev page which opens my current page with body1 and body2...and hence onclick i have a method called in the controller which return the view in body1.

but coming to body 2 it also has to by default select the 1st button and print the page from tiles.as there is no action on page open how do i invoke the method in controller on load passing the object.

if u c my tiles-def both the body1 and body2 u get from diff methods returning views...i have no clue how to show them for first time on load .


please guide me.I need to complete this as soon as possible.

any clue also would really help me.

Thanks,
sree.