You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Sudip Kumar Bhattacharya(HOTPOP)" <sk...@HotPOP.com> on 2003/10/13 08:51:03 UTC

Tiles and Java

Hi Everybody,

I just wanted to know if I can use the parameters passed to a tile in java
code? Can someone provide me some sample code which demonstrates this?

To elaborate, I am passing some parameters to a tile. The tile is a JSP page
and in that JSP page I have some java code as well. I would like to access
the value of the tile parameter in my Java code. That's it!!

Any type of help will be appreciated.

Sudip



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [RE-POST]: HOW TO Use Tiles parameters in Java

Posted by Frank Maritato <fr...@overture.com>.
You have to redefine the variable to be in the request scope. Right now 
it only exists in the tiles scope. In pageLayout.jsp you need to add the 
line:

<bean:define id="pageid" name="pageid" toScope="request" />

another way to do it is:

<tiles:useAttribute id="pageid" name="pageid" scope="request" />

now you can access pageid like this: <%=pageid%>

Sudip Kumar Bhattacharya(HOTPOP) wrote:
> Hi,
> 
> I sent the mail earlier but recieved no reply. So I am posting it again with
> more code details.
> 
> My login.jsp given below assigns the parameter *pageid* a value of 1001. I
> need to retrieve this pageid value in tile menu.jsp. How can I do that? I am
> able to retrieve the pageid parameter in my pageLayout.jsp using
> tiles:useAttribute, but it is not accessible in menu.jsp.
> Can somebody guide me in this??
> 
> ---------login.jsp------------------------------------------
> <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
> <tiles:insert page="/layouts/pageLayout.jsp" flush="true">
>   <tiles:put name="pageid" value="1001" />
>   <tiles:put name="title" value="Log In" />
>   <tiles:put name="header" value="/tiles/header_1.jsp" />
>   <tiles:put name="footer" value="/tiles/footer.jsp" />
>   <tiles:put name="menu" value="/tiles/menu.jsp" />
>   <tiles:put name="body" value="/tiles/login_body.jsp" />
> </tiles:insert>
> ------------------------------------------------------------
> 
> 
> Thanks in advance,
> Sudip
> 
> -----Original Message-----
> From: Sudip Kumar Bhattacharya(HOTPOP) [mailto:skbjunkacc@HotPOP.com]
> Sent: Monday, October 13, 2003 12:21 PM
> To: Struts Users Mailing List
> Subject: Tiles and Java
> 
> 
> Hi Everybody,
> 
> I just wanted to know if I can use the parameters passed to a tile in java
> code? Can someone provide me some sample code which demonstrates this?
> 
> To elaborate, I am passing some parameters to a tile. The tile is a JSP page
> and in that JSP page I have some java code as well. I would like to access
> the value of the tile parameter in my Java code. That's it!!
> 
> Any type of help will be appreciated.
> 
> Sudip
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 

-- 
Frank Maritato


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: [RE-POST]: HOW TO Use Tiles parameters in Java

Posted by "Sudip Kumar Bhattacharya(HOTPOP)" <sk...@HotPOP.com>.
Thanks Jan,

Your solution worked perfectly!!

Sudip

-----Original Message-----
From: Jan Vervecken [mailto:Jan.Vervecken@pandora.be]
Sent: Tuesday, October 14, 2003 12:40 AM
To: Struts Users Mailing List; skbjunkacc@HotPOP.com
Subject: Re: [RE-POST]: HOW TO Use Tiles parameters in Java


maybe try to put this in pageLayout.jsp

<tiles:useAttribute name="pageid" ignore="true"/>
<tiles:insert name="menu" ignore="true">
	<tiles:put name="pageid" beanName="pageid"/>
</tiles:insert>

hope this helps
-Jan Vervecken

*********** REPLY SEPARATOR  ***********

On 10/13/2003 at 5:41 PM Sudip Kumar Bhattacharya(HOTPOP) wrote:

>Hi,
>
>I sent the mail earlier but recieved no reply. So I am posting it again
>with
>more code details.
>
>My login.jsp given below assigns the parameter *pageid* a value of 1001. I
>need to retrieve this pageid value in tile menu.jsp. How can I do that? I
>am
>able to retrieve the pageid parameter in my pageLayout.jsp using
>tiles:useAttribute, but it is not accessible in menu.jsp.
>Can somebody guide me in this??
>
>---------login.jsp------------------------------------------
><%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
><tiles:insert page="/layouts/pageLayout.jsp" flush="true">
>  <tiles:put name="pageid" value="1001" />
>  <tiles:put name="title" value="Log In" />
>  <tiles:put name="header" value="/tiles/header_1.jsp" />
>  <tiles:put name="footer" value="/tiles/footer.jsp" />
>  <tiles:put name="menu" value="/tiles/menu.jsp" />
>  <tiles:put name="body" value="/tiles/login_body.jsp" />
></tiles:insert>
>------------------------------------------------------------
>
>
>Thanks in advance,
>Sudip
>
>-----Original Message-----
>From: Sudip Kumar Bhattacharya(HOTPOP) [mailto:skbjunkacc@HotPOP.com]
>Sent: Monday, October 13, 2003 12:21 PM
>To: Struts Users Mailing List
>Subject: Tiles and Java
>
>
>Hi Everybody,
>
>I just wanted to know if I can use the parameters passed to a tile in java
>code? Can someone provide me some sample code which demonstrates this?
>
>To elaborate, I am passing some parameters to a tile. The tile is a JSP
>page
>and in that JSP page I have some java code as well. I would like to access
>the value of the tile parameter in my Java code. That's it!!
>
>Any type of help will be appreciated.
>
>Sudip
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [RE-POST]: HOW TO Use Tiles parameters in Java

Posted by Jan Vervecken <Ja...@pandora.be>.
maybe try to put this in pageLayout.jsp

<tiles:useAttribute name="pageid" ignore="true"/>
<tiles:insert name="menu" ignore="true">
	<tiles:put name="pageid" beanName="pageid"/>
</tiles:insert>

hope this helps
-Jan Vervecken

*********** REPLY SEPARATOR  ***********

On 10/13/2003 at 5:41 PM Sudip Kumar Bhattacharya(HOTPOP) wrote:

>Hi,
>
>I sent the mail earlier but recieved no reply. So I am posting it again
>with
>more code details.
>
>My login.jsp given below assigns the parameter *pageid* a value of 1001. I
>need to retrieve this pageid value in tile menu.jsp. How can I do that? I
>am
>able to retrieve the pageid parameter in my pageLayout.jsp using
>tiles:useAttribute, but it is not accessible in menu.jsp.
>Can somebody guide me in this??
>
>---------login.jsp------------------------------------------
><%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
><tiles:insert page="/layouts/pageLayout.jsp" flush="true">
>  <tiles:put name="pageid" value="1001" />
>  <tiles:put name="title" value="Log In" />
>  <tiles:put name="header" value="/tiles/header_1.jsp" />
>  <tiles:put name="footer" value="/tiles/footer.jsp" />
>  <tiles:put name="menu" value="/tiles/menu.jsp" />
>  <tiles:put name="body" value="/tiles/login_body.jsp" />
></tiles:insert>
>------------------------------------------------------------
>
>
>Thanks in advance,
>Sudip
>
>-----Original Message-----
>From: Sudip Kumar Bhattacharya(HOTPOP) [mailto:skbjunkacc@HotPOP.com]
>Sent: Monday, October 13, 2003 12:21 PM
>To: Struts Users Mailing List
>Subject: Tiles and Java
>
>
>Hi Everybody,
>
>I just wanted to know if I can use the parameters passed to a tile in java
>code? Can someone provide me some sample code which demonstrates this?
>
>To elaborate, I am passing some parameters to a tile. The tile is a JSP
>page
>and in that JSP page I have some java code as well. I would like to access
>the value of the tile parameter in my Java code. That's it!!
>
>Any type of help will be appreciated.
>
>Sudip
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


[RE-POST]: HOW TO Use Tiles parameters in Java

Posted by "Sudip Kumar Bhattacharya(HOTPOP)" <sk...@HotPOP.com>.
Hi,

I sent the mail earlier but recieved no reply. So I am posting it again with
more code details.

My login.jsp given below assigns the parameter *pageid* a value of 1001. I
need to retrieve this pageid value in tile menu.jsp. How can I do that? I am
able to retrieve the pageid parameter in my pageLayout.jsp using
tiles:useAttribute, but it is not accessible in menu.jsp.
Can somebody guide me in this??

---------login.jsp------------------------------------------
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<tiles:insert page="/layouts/pageLayout.jsp" flush="true">
  <tiles:put name="pageid" value="1001" />
  <tiles:put name="title" value="Log In" />
  <tiles:put name="header" value="/tiles/header_1.jsp" />
  <tiles:put name="footer" value="/tiles/footer.jsp" />
  <tiles:put name="menu" value="/tiles/menu.jsp" />
  <tiles:put name="body" value="/tiles/login_body.jsp" />
</tiles:insert>
------------------------------------------------------------


Thanks in advance,
Sudip

-----Original Message-----
From: Sudip Kumar Bhattacharya(HOTPOP) [mailto:skbjunkacc@HotPOP.com]
Sent: Monday, October 13, 2003 12:21 PM
To: Struts Users Mailing List
Subject: Tiles and Java


Hi Everybody,

I just wanted to know if I can use the parameters passed to a tile in java
code? Can someone provide me some sample code which demonstrates this?

To elaborate, I am passing some parameters to a tile. The tile is a JSP page
and in that JSP page I have some java code as well. I would like to access
the value of the tile parameter in my Java code. That's it!!

Any type of help will be appreciated.

Sudip



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org