Session Validation

2004-02-15 Thread hhlow
Hi,

I am sorry if this question have been asked before.
How can i check session validation? to check whether if the user is
authenticated on each page.
I read somewhere about Filters
but i still do not know how to implement it.

Currently I use a LoginAction to check the user details against the database
and then do the appropriate forwarding.

Thank you
Clement


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Email with file created on the fly

2004-01-29 Thread hhlow
How can I send email with a file created on the fly using Struts?
 
Thank you
Clement



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Additional Validation

2004-01-28 Thread hhlow
Hi, 

 Question 1 : If i want do more validation with certain fields via database, how can i 
do
 it?
 i am using DynaActionForm.
 Example :
 
 Email : [EMAIL PROTECTED]
I have used the validator to validate the format but i want to check with the
database if there is the same email being used.


Question 2 : How can I send email with a file created on the fly using Struts?
 
Thank you
Clement



Re: Struts upload

2004-01-27 Thread hhlow
there is struts upload example in the struts download package
u also can use the commons package.

Clement
- Original Message - 
From: Edgar Silva [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, January 27, 2004 7:52 AM
Subject: Struts upload


 Hi Folks...


 Anybody can send to me any address of docs or articles, talking about
Struts
 uploads.

 since now...

 TIA

 Edgar

 _
 MSN Hotmail, o maior webmail do Brasil.  http://www.hotmail.com


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Real Dynamic Forms - Using DynaBeans MapBackedForms

2004-01-12 Thread hhlow
Hi Oliver,

i am doing a simple login form.
well i am using Struts bean.
anyway i print the bean out by using

bean:write name=user property=username/

but recently i have this no getter method for the bean i dun understand why.
coz i have initialised the bean.

check out the tut here..it demostrates some simple features
www.reumann.net/do/struts/lesson1
www.reumann.net/do/struts/lesson2
www.reumann.net/do/struts/lesson3

Clement

- Original Message - 
From: Oliver Thiel [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, January 12, 2004 3:31 PM
Subject: Real Dynamic Forms - Using DynaBeans  MapBackedForms


 Hi @all,


 I am relative new to Strut, but I have to | want to do a struts project
 for my studies at the university of applied science.  I try to build a
 'real' dynamic registration form using DynaBeans and Maps (all HashMaps
 will be filled by a database call later).

 What I have so far is:

 CreateFormAction.java:

 DynaActionForm mappedForm2 = (DynaActionForm) form;
 HashMap mappedForm = new HashMap();

 mappedForm.put(username, test);
 mappedForm.put(email, [EMAIL PROTECTED]);
 mappedForm.put(password, xyz);
 mappedForm.put(conf_pwd, xyz);

 mappedForm2.set(mappedForm, mappedForm);
 request.setAttribute(mappedForm2, mappedForm2);



 struts-config.xml

 form-bean dynamic=true name=mappedForm2
 type=org.apache.struts.action.DynaActionForm
 form-property name=mappedForm type=java.util.HashMap/
 form-property name=getEmail size=20 type=java.lang.String/
 /form-bean



 mappedForm.jsp

 !-- TYPE:INPUT --
 bean:define id=values name=mappedForm2 property=mappedForm
 type=java.util.HashMap/
 logic:iterate id=mappedForm name=mappedForm2 property=mappedForm
 TR
 TD width=40%bean:write name=mappedForm
 property=key/:/TD
 TDinput type=text name=bean:write name=mappedForm
 property=key /
  value=bean:write name=mappedForm property=value /
 class=Feld/TD
 /TR
   /logic:iterate
   !-- TYPE:CHECKBOX --
 TR
 TDhtml:checkbox styleClass=Check property=getEmail
 //TD
 TDbean:message key=form.getMail//TD
 /TR


 mappedForm.java (extends DynaActionForm)

 String getEmail= (String)this.get(getEmail);
 In the mappedForm.java I can only access the getMail value!

 Questions:
 1. How can I access the values from the map in my mappedForm
 validate() method? To validate them I want to use another Map, filed
 with Regular Expressions?
 2. Can I use more than one Map? Cause I also want the (input
 type=text) to be dynamic too, so that I can switch between text and
 password for example.
 3. How can I out print a 'dynamic' bean massage?
 Something like that: bean:message key=bean:write name=mappedForm
 property=value/ / But this does not work!
 4. Is their a better way in Struts to do this?
 5. Has any one done something like that before and can provide my
 some examples or code snippets?


 Thanks in advanced
 Oliver





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



No getter method for property

2004-01-07 Thread hhlow
Hi,

I am getting 
javax.servlet.jsp.JspException: No getter method for property name of bean user.
Please advise.
Clement




struts-config

!--  Form Bean Definitions --
form-beans
!-- Logon Form offers user to enter credentials to sing in --
form-bean
name=logonForm
type=logon.LogonForm/
/form-beans
!-- = Global Exception Definitions --
global-exceptions
!-- sample exception handler
exception
key=expired.password
type=app.ExpiredPasswordException
path=/changePassword.jsp/
end sample --
   /global-exceptions
!-- === Global Forward Definitions --
global-forwards
forward
name=logon
path=/logon/Logon.do/
forward
name=logoff
path=/Welcome.do/
!-- Default forward to Welcome action --
!-- Demonstrates using index.jsp to forward --
forward
name=welcome
path=/Welcome.do/
/global-forwards
!-- === Action Mapping Definitions --
action-mappings
!-- Default Welcome action --
!-- Forwards to Welcome.jsp --
action
path=/Welcome
type=org.apache.struts.actions.ForwardAction
parameter=/pages/Welcome.jsp/
action
path=/logon/Logon
type=org.apache.struts.actions.ForwardAction
parameter=/pages/logon/Logon.jsp/  
!-- LogonSubmit action --
action
path=/logon/LogonSubmit
type=logon.LogonAction
name=logonForm
scope=request
validate=true
input=/pages/logon/Logon.jsp
 forward
name=userpage
path=/pages/user/User.jsp/
 /action
/action-mappings
!-- = Controller Configuration --
controller
   processorClass=org.apache.struts.tiles.TilesRequestProcessor/
!--  Message Resources Definitions --
message-resources parameter=resources.application/
!-- === Plug Ins Configuration --
  !-- == Tiles plugin ===  --
  plug-in className=org.apache.struts.tiles.TilesPlugin 
set-property property=definitions-config 
  value=/WEB-INF/tiles-defs.xml /
set-property property=moduleAware value=true /
set-property property=definitions-parser-validate value=true /
  /plug-in
  plug-in className=org.apache.struts.validator.ValidatorPlugIn
set-property
property=pathnames
value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/
  /plug-in
/struts-config




User.java
package logon;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
/**
* Form bean for the user profile page. This form has the following fields,
* with default values in square brackets:
* ul
* li bpassword/b - Entered password value
* li busername/b - Entered username value
* /ul
*
*
[EMAIL PROTECTED] Liu Xiaoxing
*created December 18, 2003
*modified December 29, 2003
[EMAIL PROTECTED] $Revision: 1.1 $ $Date: 2003/12/29 $
*/
public final class User extends ActionForm {

//  Instance Variables
/**
* User Id.
*/
private int userId = 0;
/**
* User Name.
*/
private String userName = null;
/**
* Password.
*/
private String userPass = null;
/**
* Full Name.
*/
private String fullName = ;
/**
* Organisation.
*/
private String organisation = ;
/**
* Email.
*/
private String email = test;
/**
* Phone.
*/
private String phone = ;

// -- Properties

/**
* Return the password.
*
[EMAIL PROTECTED] The password value
*/
public String getUserPass() 
{
return (this.userPass);
}

/**
* Set the password.
*
[EMAIL PROTECTED] password The new password
*/
public void setUserPass(String userPass) 
{
this.userPass = userPass;
}

/**
* Return the username.
*
[EMAIL PROTECTED] The username value
*/
public String getUserName() 
{
return (this.userName);
}

/**
* Set the username.
*
[EMAIL PROTECTED] username The new username
*/
public void setUserName(String userName) 
{
this.userName = userName;
}
/**
* Return the name.
*
[EMAIL PROTECTED] The name value
*/
public String getFullName() 
{
return (this.fullName);
}

/**
* Set the name.
*
[EMAIL PROTECTED] name The new name
*/
public void setFullName(String fullName) 
{
this.fullName = fullName;
}

/**
* Return the organisation.
*
[EMAIL PROTECTED] The organisation value
*/
public String getOrganisation() 
{
return (this.organisation);
}

/**
* Set the organisation.
*
[EMAIL PROTECTED] organisation The new