struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Loupita <alia.h...@gmail.com>
Subject Can I send parameters between jsp pages?
Date Thu, 05 Mar 2009 10:28:01 GMT

Hello!
This is my issue:

I have a jsp with a list of users:
UserList.jsp
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>

<html>
<head>
<title>Users</title>
<sx:head parseContent="true"/>
</head>
<body>

<s:form action="PersonListAction" method="POST" validate="true">
<s:actionerror />
<s:fielderror />

<display:table name="persons" class="PersonListAction" >
  <display:column title="Förnamn" property="firstName" sortable="false" />
  <display:column title = "Efternamn" property="lastName" sortable="false"
/>
  <display:column title = "E-mail" property="email" sortable="false"
href="UpdateDeleteUserAction.action" paramProperty="id" paramId="p"/>
  <display:column title = "Företag" property="company" sortable="false" />
  <display:column title = "Mobilnummer" property="mobile" sortable="false"
/>

</display:table>
</s:form>
</body>
</html>

The jsp page looks like this when displayed:

http://www.nabble.com/file/p22348937/list.jpeg 

The email addresses are links that call UdateDeleteUserAction.action, which
redirects to  UpdateUser.jsp which has a form. When clicking an email adress
the id of that user is sent along with the URL as a parameter.
Ex:
http://localhost:8080/RoomBooking/action/UpdateDeleteUserAction.action?p=10

UpdateUser.jsp
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>Add new user.</title>
<link href="<s:url value="/css/main.css"/>" rel="stylesheet"
type="text/css"/>
</head>
<body>
<s:form action="UpdateDeleteUserAction_*" method="POST" validate="true">
  
<s:actionerror />
<s:fielderror />
<s:hidden name="id" value="?"/>
<s:textfield name="firstName" label="Firstname"/>
<s:textfield name="lastName" label="Lastname"/>
<s:textfield name="email" label="E-mail"/>
<s:textfield name="phone" label="Mobile no."/>
<s:textfield name="company" label="Company"/>
<s:submit action="UpdateDeleteUserAction_update" value="update"/>  
<s:submit action="UpdateDeleteUserAction_delete" value="delete"/>
<s:submit action="UpdateDeleteUserAction_cancel" value="cancel"/>
</s:form>

</body>
</html>

I want the id which is sent with the URL to be set instead of the "?" in :
<s:hidden name="id" value="?"/>
In this case I want the outcome to be: <s:hidden name="id" value="10"/>

I know it's an ugly solution since the id of the user will be seen by
everyone. If you have any idea on how to do the same thing in a more secure
way, please tell.

Anyway, how can I do to get the id (p) from the URL to be set as the value
in the <s:hidden> tag?

Thanks in advance,
Alia
-- 
View this message in context: http://www.nabble.com/Can-I-send-parameters-between-jsp-pages--tp22348937p22348937.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Mime
View raw message