Blank page after form validation

2004-01-13 Thread VENKATESH GANGAL
Hi All,

We have been facing a very strange problem with form validation

We have a JSP which is an input to an action and there is an associated form bean to 
validate the form.

Here is the configuaration file
struts-config.xml:


  





  





 

  

validation.xml :




   
   
   
 




MessageResources.properties
form.error.productRef = Please enter Product Reference

FormBean Validation method :

 public ActionErrors validate(ActionMapping mapping,HttpServletRequest request) 
   {
   //ActionErrors errors = super.validate(mapping, request);
   ActionErrors errors = new ActionErrors();
if ((productRef == null) || (productRef.trim().length()< 1)){
errors.add ("productRef",new 
ActionError("form.error.productRef"));
}

   return errors ;
   }


Here is the JSP





 


  
   
  
 

   
   
 



When I submit this form without entering anything in the textfield, it is taking me to 
a blank page.

Can anyone let me know why this is happening? It is not going to the action at all and 
is returning with errors to the JSP.I am not able to reach the page from where I 
submitted the data along with errors.The error was added to ActionErrors object.

We are using oc4j(Oracle Apps) standalone application.We are using struts 1.1

Thanks in advance for your help.

Cheers...
Venkatesh






Re:Dynamic retrive

2004-01-13 Thread Karthik R
Hi,

 ---
 one
 two

 

if i select two then it will include table in same page.plz send the code


Hi Dynamic retrive

2004-01-13 Thread Karthik R
Hi,
 
  ---
  one
  two

  

if i select two then it will include table in same page.plz send the code

On Wed, 14 Jan 2004 shankarr wrote :
>Hi!
>What is worrying me is that the number of activeCount and useCount are increasing 
>though there have been no db interactions.
>Any help, appreciated.
>
>This is my data source entry from struts-config.xml file. Is there something wrong in 
>it ?
>
>   
>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>
>   
>
>This is how I get my dbconnection in my action files
>
>   Connection conn = null;
> Statement stmt = null;
> ResultSet rs = null;
>
> ServletContext context = servlet.getServletContext();
> DataSource dataSource = (DataSource) 
> context.getAttribute(Action.DATA_SOURCE_KEY);
> String target = "success";
> conn = dataSource.getConnection();
> stmt = conn.createStatement();
>
>
>I am getting the following in my tomcat prints.
>
>
>INFO:Found available connection
>Jan 14, 2004 10:04:32 AM org.apache.struts.legacy.GenericDataSource getConnectio
>n
>INFO:Return allocated connection, activeCount=29, useCount=29
>Jan 14, 2004 10:04:34 AM org.apache.struts.legacy.GenericDataSource getConnectio
>n
>INFO:   getConnection()
>Jan 14, 2004 10:04:34 AM org.apache.struts.legacy.GenericDataSource getConnectio
>n
>INFO:Check for timeout, activeCount=29, useCount=29
>Jan 14, 2004 10:04:34 AM org.apache.struts.legacy.GenericDataSource createConnec
>tion
>INFO:createConnection()
>Jan 14, 2004 10:04:34 AM org.apache.struts.legacy.GenericDataSource getConnectio
>n
>INFO:Return new connection, activeCount=30, useCount=30
>Jan 14, 2004 10:04:39 AM org.apache.struts.legacy.GenericDataSource getConnectio
>n
>INFO:   getConnection()
>Jan 14, 2004 10:04:39 AM org.apache.struts.legacy.GenericDataSource getConnectio
>
>
>Sha


activeCount, useCount increasing automatically

2004-01-13 Thread shankarr
Hi!
What is worrying me is that the number of activeCount and useCount are 
increasing though there have been no db interactions.
Any help, appreciated.

This is my data source entry from struts-config.xml file. Is there 
something wrong in it ?

  






















  

This is how I get my dbconnection in my action files

  Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
ServletContext context = servlet.getServletContext();
DataSource dataSource = (DataSource) 
context.getAttribute(Action.DATA_SOURCE_KEY);
String target = "success";
conn = dataSource.getConnection();
stmt = conn.createStatement();

I am getting the following in my tomcat prints.

INFO:Found available connection
Jan 14, 2004 10:04:32 AM org.apache.struts.legacy.GenericDataSource 
getConnectio
n
INFO:Return allocated connection, activeCount=29, useCount=29
Jan 14, 2004 10:04:34 AM org.apache.struts.legacy.GenericDataSource 
getConnectio
n
INFO:   getConnection()
Jan 14, 2004 10:04:34 AM org.apache.struts.legacy.GenericDataSource 
getConnectio
n
INFO:Check for timeout, activeCount=29, useCount=29
Jan 14, 2004 10:04:34 AM org.apache.struts.legacy.GenericDataSource 
createConnec
tion
INFO:createConnection()
Jan 14, 2004 10:04:34 AM org.apache.struts.legacy.GenericDataSource 
getConnectio
n
INFO:Return new connection, activeCount=30, useCount=30
Jan 14, 2004 10:04:39 AM org.apache.struts.legacy.GenericDataSource 
getConnectio
n
INFO:   getConnection()
Jan 14, 2004 10:04:39 AM org.apache.struts.legacy.GenericDataSource 
getConnectio

Sha


Re: Database pool full.

2004-01-13 Thread virupaksha
Dear Max,

Yah, this problem occures after  visiting some pages,
to use #1 strategy, whether I need to do any changes in configuration or is
there any other way?

Thanks for your suggestions & immediate response,

Regards,
viru


- Original Message -
From: "Max Cooper" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Wednesday, January 14, 2004 12:30 PM
Subject: Re: Database pool full.


> My guess is that you have a connection leak somewhere. Does this problem
> start occurring immediately, or does it only show up after visiting a
number
> of pages in the site?
>
> Various db pools have different ways of dealing with no connections being
> available. Often, you can configure which strategy to use. Here are 3
> different strategies:
>
> 1. Wait until a connection becomes available.
> 2. Fail if no connections are available (i.e. return null or throw an
> exception).
> 3. Grow the pool temporarily if there are no free connections.
>
> It is clear from the errors you are getting that your pool is currently
> using strategy #2. I like #1 the best, because it is less likely that
> requests will fail under load. But, you must be sure that you don't have
any
> connection leaks, because the app will eventually hang if you have
> connection leaks and use strategy #1. Strategy #3 works, but you can run
> still run out of connections in the database itself, so it can start to
act
> like strategy #2. This is one aspect of connection pooling that important
to
> consider when developing web apps.
>
> But, it seems likely that you have leaks somewhere. Some of your requests
> are probably not returning their connections to the pool. It could be that
> you have exceptions that are being thrown and not releasing the
connection,
> or it could just be that you have non-exception logic paths that don't
> return the connections. Some combination of code reviews, debugging, etc.
is
> needed to track them down.
>
> Another thing to watch out for is requests that require more than 1
> simultaneous connection. For instance, consider the situation where you
have
> a pool of 30 connections, 15 request handler threads, and a request that
> requires 3 connections. If 15 of those requests come in at once, and each
> request handler thread grabs 2 connections, you will have deadlock as all
> the request handler threads wait forever for a third db connection to
become
> available (assuming you are using pooling strategy #1 above). The solution
> to this problem is to make sure that you don't have any requests that
> require more than one simultaneous connection, or at least that your db
> connection pool has enough connections to survive a flood of connection
> hungry requests (e.g. have a pool of 45 connections in the example
scenario
> described above -- 3 conn/req * 15 threads = 45 connections in the pool).
> This may seem unlikely, but it is a problem I have faced in a production
> system (and it wasn't easy to track down!). Another lister here suggested
a
> good technique for ensuring that none of your requests require more than 1
> simultaneous connection -- test your app with a pool of 1 connections.
>
> -Max
>
> - Original Message -
> From: "virupaksha" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Tuesday, January 13, 2004 7:14 PM
> Subject: Database pool full.
>
>
> Dear All,
>
> I am developing an application on resin-2.1.9 web server.
> Connection to MYSQL Database is using JNDI. JNDI connection code is
written
> in a class called DBService.
> I am instantiating DBService class where ever i need database connection
and
> getting connection using getConnection() method.
>
> when user start working on  application, i m getting following errors,
>
> Class:DBService. Method:getConnection() cann't open connection with full
> database pool(30)
> Class:MonthReport. Method:SelectReportDetailNull() cann't open connection
> with full database pool(30)
>
> it sounds like database pool is full, Whether i need to increase the pool
> size or optimize code in DBService database connection class.
>
> for your reference below code  performs database connection.
>
> --
> public Connection getConnection()
> {
> java.sql.Connection con = null;
> javax.sql.DataSource ds=null;
>
> try{
>
> Context initCtx = new InitialContext();
> Context envCtx = (Context) initCtx.lookup("java:comp/env");
> ds= (DataSource)envCtx.lookup("jdbc/training");
> con = ds.getConnection();
>
> }catch(Exception e){
> System.out.println("Class : DBService, Method :
> getConnection()"+e.getMessage());
> }
> return con;
>
> }//end of getConnection method
> -
>
> Your advice will be great help to optimize my application.
>
> Thanks in advance.
>
> Rega

Re: Database pool full.

2004-01-13 Thread Max Cooper
My guess is that you have a connection leak somewhere. Does this problem
start occurring immediately, or does it only show up after visiting a number
of pages in the site?

Various db pools have different ways of dealing with no connections being
available. Often, you can configure which strategy to use. Here are 3
different strategies:

1. Wait until a connection becomes available.
2. Fail if no connections are available (i.e. return null or throw an
exception).
3. Grow the pool temporarily if there are no free connections.

It is clear from the errors you are getting that your pool is currently
using strategy #2. I like #1 the best, because it is less likely that
requests will fail under load. But, you must be sure that you don't have any
connection leaks, because the app will eventually hang if you have
connection leaks and use strategy #1. Strategy #3 works, but you can run
still run out of connections in the database itself, so it can start to act
like strategy #2. This is one aspect of connection pooling that important to
consider when developing web apps.

But, it seems likely that you have leaks somewhere. Some of your requests
are probably not returning their connections to the pool. It could be that
you have exceptions that are being thrown and not releasing the connection,
or it could just be that you have non-exception logic paths that don't
return the connections. Some combination of code reviews, debugging, etc. is
needed to track them down.

Another thing to watch out for is requests that require more than 1
simultaneous connection. For instance, consider the situation where you have
a pool of 30 connections, 15 request handler threads, and a request that
requires 3 connections. If 15 of those requests come in at once, and each
request handler thread grabs 2 connections, you will have deadlock as all
the request handler threads wait forever for a third db connection to become
available (assuming you are using pooling strategy #1 above). The solution
to this problem is to make sure that you don't have any requests that
require more than one simultaneous connection, or at least that your db
connection pool has enough connections to survive a flood of connection
hungry requests (e.g. have a pool of 45 connections in the example scenario
described above -- 3 conn/req * 15 threads = 45 connections in the pool).
This may seem unlikely, but it is a problem I have faced in a production
system (and it wasn't easy to track down!). Another lister here suggested a
good technique for ensuring that none of your requests require more than 1
simultaneous connection -- test your app with a pool of 1 connections.

-Max

- Original Message - 
From: "virupaksha" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, January 13, 2004 7:14 PM
Subject: Database pool full.


Dear All,

I am developing an application on resin-2.1.9 web server.
Connection to MYSQL Database is using JNDI. JNDI connection code is written
in a class called DBService.
I am instantiating DBService class where ever i need database connection and
getting connection using getConnection() method.

when user start working on  application, i m getting following errors,

Class:DBService. Method:getConnection() cann't open connection with full
database pool(30)
Class:MonthReport. Method:SelectReportDetailNull() cann't open connection
with full database pool(30)

it sounds like database pool is full, Whether i need to increase the pool
size or optimize code in DBService database connection class.

for your reference below code  performs database connection.

--
public Connection getConnection()
{
java.sql.Connection con = null;
javax.sql.DataSource ds=null;

try{

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
ds= (DataSource)envCtx.lookup("jdbc/training");
con = ds.getConnection();

}catch(Exception e){
System.out.println("Class : DBService, Method :
getConnection()"+e.getMessage());
}
return con;

}//end of getConnection method
-

Your advice will be great help to optimize my application.

Thanks in advance.

Regards,
Viru


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



Re: handling form based authentication w/ remember-me cookie

2004-01-13 Thread Matt Raible
They should be getting called for both - since they both are a 
"request".  You might try adding the  element to trap 
forwards as well.  This is a Servlet 2.4 feature.


loginFilter
/security/*

REQUEST
FORWARD


On Jan 13, 2004, at 12:19 PM, [EMAIL PROTECTED] wrote:

Are Servlet filters supposed to be called for both GET and POST
methods? They seem to be getting called for GETs only on Tomcat 5.
-Chris

-Original Message-
From: Parmar, Dipakkumar [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 13, 2004 03:57 PM
To: 'Struts Users Mailing List'
Subject: RE: handling form based authentication w/ remember-me cookie
Hi Max,

I haven't tested it either.  I read it about this in "IBM WebSphere 
V5.0
Security handbook (page 64)".

Regards,
Dipak Parmar
-Original Message-
From: Max Cooper [mailto:[EMAIL PROTECTED]
Sent: Monday, January 12, 2004 10:42 PM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: Re: handling form based authentication w/ remember-me cookie
Dipak,

Are you certain that the filter will be invoked on the 
/j_security_check
request when container-based security is used? I have not tested 
this, but
it would not surprise me to find that some containers do not execute 
filters
on /j_security_check requests. I don't know if the Servlet Spec says
anything about this case.

Chris,

Another alternative to the original problem of security with 
"remember me"
functionality will be available soon. A patch has been submitted to my
SecurityFilter project (http://www.securityfilter.org/) to support 
"remember
me" functionality. The integration should be complete soon, and a beta
release will be made available once the integration is complete.
SecurityFilter works very much like container-managed security 
otherwise,
including the configuration format (except that you declare the 
constraints
in a separate config file rather than web.xml).

-Max

- Original Message -
From: "Parmar, Dipakkumar" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Monday, January 12, 2004 7:43 AM
Subject: RE: handling form based authentication w/ remember-me cookie

Hi Chris,

You can do this using Servlet Filter.  What you need to do is write
postLoginFilter that maps to the j_security_check url.
In doFilter method, you can write your post login code after
j_security_check done is work.
Something like:
public void doFilter(.)
// let the j_security_check to do it's work
chain.doFilter(request, response)
// do you post login stuff here

Regards,
Dipak Parmar


-Original Message-
From: Chris Ruegger [mailto:[EMAIL PROTECTED]
Sent: Monday, January 12, 2004 9:53 AM
To: Struts Users Mailing List
Subject: handling form based authentication w/ remember-me cookie
I am using Struts and building a logon page to do Form-based
authentication
under Tomcat. I want to also have a checkbox for the user to check 
that
says
"remember me" so that I can send them a cookie.  I'm not sure how to
"intercept"
the form values because I have to post to j_security_check. How can 
I get
the
check-box value, set up the cookie, and send them to 
j_security_check with
struts?

Thanks

-
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]



-
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]


BeanUtils.populate Invocation Error

2004-01-13 Thread Nathan Ewing
I have a jsp page with a form on it using indexed properties.  I have a bean
with an array of beans that I use to connect with the jsp page.  The page
displays fine, but when I try to save it, I get the following error:

javax.servlet.ServletException: BeanUtils.populate
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j
ava:821)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardW
rapperValve.java:720)
at
org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValv
e.java:118)
at
org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.jav
a:278)
at java.security.AccessController.doPrivileged(Native Method)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:274)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:212)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203
)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at
com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.ja
va:157)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)


Root Cause

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.
java:493)
at
org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.
java:428)
at
org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.j
ava:770)
at
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:80
1)
at
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:881)
at
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)
at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j
ava:821)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardW
rapperValve.java:720)
at
org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValv
e.java:118)
at
org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.jav
a:278)
at java.security.AccessController.doPrivileged(Native Method)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:274)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:212)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203
)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at
com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.ja
va:157)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)
Caused by: java.lang.NullPointerException
at
com.mysite.bean.SoldProperty.getExclusiveSold(SoldProperty.java:573)


Here is the relevant code:


protected SoldProperty[] ExclusiveSold; 
protected SoldProperty[] BuyerSold; 

/**
Set the Value of ExclusiveSold to ExclusiveSoldValue

@param   ExclusiveSoldValue The value of the variable ExclusiveSold
in the Object
*/
public void setExclusiveSold (SoldProperty[] E

Database pool full.

2004-01-13 Thread virupaksha
Dear All,

I am developing an application on resin-2.1.9 web server.
Connection to MYSQL Database is using JNDI. JNDI connection code is written in a class 
called DBService.
I am instantiating DBService class where ever i need database connection and getting 
connection using getConnection() method.

when user start working on  application, i m getting following errors,

Class:DBService. Method:getConnection() cann't open connection with full database 
pool(30)
Class:MonthReport. Method:SelectReportDetailNull() cann't open connection with full 
database pool(30)

it sounds like database pool is full, Whether i need to increase the pool size or 
optimize code in DBService database connection class.

for your reference below code  performs database connection.

--
public Connection getConnection()
{
java.sql.Connection con = null;
javax.sql.DataSource ds=null;

try{

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
ds= (DataSource)envCtx.lookup("jdbc/training");
con = ds.getConnection();

}catch(Exception e){
System.out.println("Class : DBService, Method : 
getConnection()"+e.getMessage());
}
return con;

}//end of getConnection method
-

Your advice will be great help to optimize my application.

Thanks in advance.

Regards,
Viru

Re: converting with variable target into

2004-01-13 Thread hgosper
I like to avoid putting javascript logic in the JSP tag itself (although 
you can usually do it if you get the syntax right).

I usually pull the script out of the tag like this:


function deleteEvent()
{
if (confirm('Do you want to delete this event?'))
{
location = '/EventDelete.do?e=' + 
document.all("eventId").value;
}

}









I know that's a bit different to what you are doing but that is how I 
would do it and your javascript is nice and clear (you can even put it in 
a separate file).



Heya Gosper
CSC Australia
212 Northbourne Ave, Braddon ACT 2612
Ph: +61 (0) 2 6246 8155  Fax: +61 (0) 2 62468100
MOB: 0401 611779

This is a PRIVATE message. If you are not the intended recipient, please 
delete without copying and kindly advise us by e-mail of the mistake in 
delivery. NOTE: Regardless of content, this e-mail shall not operate to 
bind CSC to any order or other contract unless pursuant to explicit 
written agreement or government initiative expressly permitting the use of 
e-mail for such purpose.






"Ricky Purnomo" <[EMAIL PROTECTED]>
14/01/2004 02:00 PM
Please respond to "Struts Users Mailing List"

 
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
cc: 
Subject:converting  with variable target into 


I am converting a pure JSP page into Struts, and am having problem
converting links which calls a javascript and has dynamically specified
target. The particular line is below:

Delete

My current converted line reads:

'" class="eventheaderlink">

but I cannot find an equivalent using , problem being I cannot
add the closing single quote back (or more generally stated, I cannot have
"constant"+variable+"constant" in the link). My attempt:



is missing the last ' and causes error.

So is there a way to do this in ?

And is there a need to convert all  to  in the first place?
Because I am also having problem converting

<%=
htmlescape(evcontactemail) %>

into , since there is no paramId that I can specify, and using
paramId always automatically add a ? to the created link.


Thanks in advance on any pointers,
Ricky Purnomo

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





converting with variable target into

2004-01-13 Thread Ricky Purnomo
I am converting a pure JSP page into Struts, and am having problem
converting links which calls a javascript and has dynamically specified
target. The particular line is below:

Delete

My current converted line reads:

'" class="eventheaderlink">

but I cannot find an equivalent using , problem being I cannot
add the closing single quote back (or more generally stated, I cannot have
"constant"+variable+"constant" in the link). My attempt:



is missing the last ' and causes error.

So is there a way to do this in ?

And is there a need to convert all  to  in the first place?
Because I am also having problem converting

<%=
htmlescape(evcontactemail) %>

into , since there is no paramId that I can specify, and using
paramId always automatically add a ? to the created link.


Thanks in advance on any pointers,
Ricky Purnomo

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



Re: handling form based authentication w/ remember-me cookie

2004-01-13 Thread Chris Ruegger
Craig,
Ok fair enough. If the spec says it is undefined, that what is one to do?
Keep in mind I'm trying to do the right thing here and build an application
where people can logon AND I can send them a cookie to remember their user
ID.
What is the propery way to do this under J2EE/Struts? Apparently I'm not
allowed
to intercept calls to j_security_check so I should be doing something else?
That's fine,
lots of web sites do this, how should I be doing it?
Thanks,
Chris

- Original Message -
From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, January 13, 2004 6:16 PM
Subject: Re: handling form based authentication w/ remember-me cookie


> Quoting [EMAIL PROTECTED]:
>
> >
> > Are Servlet filters supposed to be called for both GET and POST
> > methods? They seem to be getting called for GETs only on Tomcat 5.
> > -Chris
>
> For filters mapped to ordinary application URLs, the filter should indeed
get
> mapped on both GET and POST methods.  For filters you attempt to put on
> "/j_security_check" you are totally outside the bounds of the servlet
> specification, and the only thing you can assume is that the behavior is
> undefined.
>
> Personally, I consider it a bug that Tomcat 5 invokes filters on this,
even if
> it's just on a GET.
>
> Craig McClanahan
>
>
> >
> >
> > > -Original Message-
> > > From: Parmar, Dipakkumar [mailto:[EMAIL PROTECTED]
> > > Sent: Tuesday, January 13, 2004 03:57 PM
> > > To: 'Struts Users Mailing List'
> > > Subject: RE: handling form based authentication w/ remember-me cookie
> > >
> > > Hi Max,
> > >
> > > I haven't tested it either.  I read it about this in "IBM WebSphere
V5.0
> > > Security handbook (page 64)".
> > >
> > > Regards,
> > > Dipak Parmar
> > >
> > >
> > > -Original Message-
> > > From: Max Cooper [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, January 12, 2004 10:42 PM
> > > To: Struts Users Mailing List; [EMAIL PROTECTED]
> > > Subject: Re: handling form based authentication w/ remember-me cookie
> > >
> > >
> > > Dipak,
> > >
> > > Are you certain that the filter will be invoked on the
/j_security_check
> > > request when container-based security is used? I have not tested this,
but
> > > it would not surprise me to find that some containers do not execute
> > filters
> > > on /j_security_check requests. I don't know if the Servlet Spec says
> > > anything about this case.
> > >
> > > Chris,
> > >
> > > Another alternative to the original problem of security with "remember
me"
> > > functionality will be available soon. A patch has been submitted to my
> > > SecurityFilter project (http://www.securityfilter.org/) to support
> > "remember
> > > me" functionality. The integration should be complete soon, and a beta
> > > release will be made available once the integration is complete.
> > > SecurityFilter works very much like container-managed security
otherwise,
> > > including the configuration format (except that you declare the
> > constraints
> > > in a separate config file rather than web.xml).
> > >
> > > -Max
> > >
> > > - Original Message -
> > > From: "Parmar, Dipakkumar" <[EMAIL PROTECTED]>
> > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > > Sent: Monday, January 12, 2004 7:43 AM
> > > Subject: RE: handling form based authentication w/ remember-me cookie
> > >
> > >
> > > > Hi Chris,
> > > >
> > > > You can do this using Servlet Filter.  What you need to do is write
> > > > postLoginFilter that maps to the j_security_check url.
> > > >
> > > > In doFilter method, you can write your post login code after
> > > > j_security_check done is work.
> > > >
> > > > Something like:
> > > > public void doFilter(.)
> > > >
> > > > // let the j_security_check to do it's work
> > > > chain.doFilter(request, response)
> > > >
> > > > // do you post login stuff here
> > > >
> > > > Regards,
> > > > Dipak Parmar
> > > >
> > > >
> > > >
> > > > -Original Message-
> > > > From: Chris Ruegger [mailto:[EMAIL PROTECTED]
> > > > Sent: Monday, January 12, 2004 9:53 AM
> > > > To: Struts Users Mailing List
> > > > Subject: handling form based authentication w/ remember-me cookie
> > > >
> > > >
> > > > I am using Struts and building a logon page to do Form-based
> > > authentication
> > > > under Tomcat. I want to also have a checkbox for the user to check
that
> > > says
> > > > "remember me" so that I can send them a cookie.  I'm not sure how to
> > > > "intercept"
> > > > the form values because I have to post to j_security_check. How can
I
> > get
> > > > the
> > > > check-box value, set up the cookie, and send them to
j_security_check
> > with
> > > > struts?
> > > >
> > > > Thanks
> > > >
> > > >
> > >
> -
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > >
> > > -

Struts 1.1 on iPlanet 6.05 iws (one more time)

2004-01-13 Thread Fowler, David
I'm a little closer.

I am running Struts 1.1 on iPlanet iws 6.05 (it works fine on tomcat 3.3.1).  I am 
using JDK 1.4.1_05 (JDK 1.4.1_01 is the highest supported on 6.05).  The app is 
running on Windows 2000 - destined for HPUX.  I am also using tiles and validation.

At first, nothing worked.  I changed the action forwards to redirect=true.  I also 
moved the ApplicationResources.properties to the application context root directory 
(instead of WEB-INF/classes).  Now everything seems to work with one exception.  Any 
page using a dto throws a servlet exception.  If I take the dto out, everything works 
(of course the dto is the heart of the matter).

I've increased the maxHeapSize to 67108864 and the StackSize to 1024000 (I'm way out 
of my league here).  I have not set a size for my page output buffer.

Are there any suggestions about what paths I might investigate or what damage I have 
done???

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



Re: handling form based authentication w/ remember-me cookie

2004-01-13 Thread Nadeem Bitar

It is a huge disappointment that the servlet 2.4 specification didn't
address programmatic authentication. Dispatching requests to
j_security_check is a pain in many use cases.

I really hope that a future version of tomcat would address this even if
this didn't make it into the spec this time.

On 火, 2004-01-13 at 15:16, Craig R. McClanahan wrote:
> Quoting [EMAIL PROTECTED]:
> 
> > 
> > Are Servlet filters supposed to be called for both GET and POST
> > methods? They seem to be getting called for GETs only on Tomcat 5.
> > -Chris
> 
> For filters mapped to ordinary application URLs, the filter should indeed get
> mapped on both GET and POST methods.  For filters you attempt to put on
> "/j_security_check" you are totally outside the bounds of the servlet
> specification, and the only thing you can assume is that the behavior is
> undefined.
> 
> Personally, I consider it a bug that Tomcat 5 invokes filters on this, even if
> it's just on a GET.
> 
> Craig McClanahan
> 
> 
> > 
> > 
> > > -Original Message-
> > > From: Parmar, Dipakkumar [mailto:[EMAIL PROTECTED]
> > > Sent: Tuesday, January 13, 2004 03:57 PM
> > > To: 'Struts Users Mailing List'
> > > Subject: RE: handling form based authentication w/ remember-me cookie
> > > 
> > > Hi Max,
> > > 
> > > I haven't tested it either.  I read it about this in "IBM WebSphere V5.0
> > > Security handbook (page 64)".
> > > 
> > > Regards,
> > > Dipak Parmar
> > > 
> > > 
> > > -Original Message-
> > > From: Max Cooper [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, January 12, 2004 10:42 PM
> > > To: Struts Users Mailing List; [EMAIL PROTECTED]
> > > Subject: Re: handling form based authentication w/ remember-me cookie
> > > 
> > > 
> > > Dipak,
> > > 
> > > Are you certain that the filter will be invoked on the /j_security_check
> > > request when container-based security is used? I have not tested this, but
> > > it would not surprise me to find that some containers do not execute
> > filters
> > > on /j_security_check requests. I don't know if the Servlet Spec says
> > > anything about this case.
> > > 
> > > Chris,
> > > 
> > > Another alternative to the original problem of security with "remember me"
> > > functionality will be available soon. A patch has been submitted to my
> > > SecurityFilter project (http://www.securityfilter.org/) to support
> > "remember
> > > me" functionality. The integration should be complete soon, and a beta
> > > release will be made available once the integration is complete.
> > > SecurityFilter works very much like container-managed security otherwise,
> > > including the configuration format (except that you declare the
> > constraints
> > > in a separate config file rather than web.xml).
> > > 
> > > -Max
> > > 
> > > - Original Message -
> > > From: "Parmar, Dipakkumar" <[EMAIL PROTECTED]>
> > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > > Sent: Monday, January 12, 2004 7:43 AM
> > > Subject: RE: handling form based authentication w/ remember-me cookie
> > > 
> > > 
> > > > Hi Chris,
> > > >
> > > > You can do this using Servlet Filter.  What you need to do is write
> > > > postLoginFilter that maps to the j_security_check url.
> > > >
> > > > In doFilter method, you can write your post login code after
> > > > j_security_check done is work.
> > > >
> > > > Something like:
> > > > public void doFilter(.)
> > > >
> > > > // let the j_security_check to do it's work
> > > > chain.doFilter(request, response)
> > > >
> > > > // do you post login stuff here
> > > >
> > > > Regards,
> > > > Dipak Parmar
> > > >
> > > >
> > > >
> > > > -Original Message-
> > > > From: Chris Ruegger [mailto:[EMAIL PROTECTED]
> > > > Sent: Monday, January 12, 2004 9:53 AM
> > > > To: Struts Users Mailing List
> > > > Subject: handling form based authentication w/ remember-me cookie
> > > >
> > > >
> > > > I am using Struts and building a logon page to do Form-based
> > > authentication
> > > > under Tomcat. I want to also have a checkbox for the user to check that
> > > says
> > > > "remember me" so that I can send them a cookie.  I'm not sure how to
> > > > "intercept"
> > > > the form values because I have to post to j_security_check. How can I
> > get
> > > > the
> > > > check-box value, set up the cookie, and send them to j_security_check
> > with
> > > > struts?
> > > >
> > > > Thanks
> > > >
> > > >
> > > > -
> > > > 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]
> > > 
> > > 
> > 
> > 
> > 
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 

Re: redirecting to fully qualified hostname

2004-01-13 Thread Craig R. McClanahan
Quoting "Fullam, Jonathan" <[EMAIL PROTECTED]>:

> All,
> 
> The application I am working on is secured with a login that required a
> username and password.  Once a user is logged in, all pages can be accessed
> as long as there is a Subject object in the Session.  My problem is that
> part of the webapp provided links to pages that open in another window, and
> when the link is clicked, it is forwarding to the logon page as if the
> Subject object is no longer in the Session.  I've determined that this
> behavior is only present when the hostname used for the request is not fully
> qualified upon the intial logon.
> 

This is really a question for your servlet container provider, since it's not
Struts specific.  It's up to the server configuration whether "serverName" and
"serverName.mycompany.com" are considered to be the same virtual host or not
(which would be a prerequisite to sharing the session).  A couple of approaches
to consider:

* If your webserver considers the two to be different,
  put a redirect on one so that you always end up on the other.

* Construct all your hyperlinks without the "http://host"; part,
  and just start with a slash followed by the context path.
  That way, the browser will reconstruct an absolute URL
  using the server name (qualified or not) that came in on
  the original request.

Craig

> For instance.
> 
> User logons on by going to http://serverName/webapp/logon.do
> 
> Then the application provides a link to
> http://serverName.mycompany.com/webapp/something.do which open a page in a
> new window.
> 
> When the user click the link, a new window is opened but they are forwarded
> to the logon page as if they never logged on in the first place.
> 
> How can I have all requests to the original hostname
> http://serverName/webapp be redirected to
> http://serverName.mycompany.com/webapp ?  Is there anybody out there that
> has experienced this or knows of a better way to work around this issue?
> 
> Thanks in Advance,
> Jonathan
> 




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



Re: handling form based authentication w/ remember-me cookie

2004-01-13 Thread Craig R. McClanahan
Quoting [EMAIL PROTECTED]:

> 
> Are Servlet filters supposed to be called for both GET and POST
> methods? They seem to be getting called for GETs only on Tomcat 5.
> -Chris

For filters mapped to ordinary application URLs, the filter should indeed get
mapped on both GET and POST methods.  For filters you attempt to put on
"/j_security_check" you are totally outside the bounds of the servlet
specification, and the only thing you can assume is that the behavior is
undefined.

Personally, I consider it a bug that Tomcat 5 invokes filters on this, even if
it's just on a GET.

Craig McClanahan


> 
> 
> > -Original Message-
> > From: Parmar, Dipakkumar [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, January 13, 2004 03:57 PM
> > To: 'Struts Users Mailing List'
> > Subject: RE: handling form based authentication w/ remember-me cookie
> > 
> > Hi Max,
> > 
> > I haven't tested it either.  I read it about this in "IBM WebSphere V5.0
> > Security handbook (page 64)".
> > 
> > Regards,
> > Dipak Parmar
> > 
> > 
> > -Original Message-
> > From: Max Cooper [mailto:[EMAIL PROTECTED]
> > Sent: Monday, January 12, 2004 10:42 PM
> > To: Struts Users Mailing List; [EMAIL PROTECTED]
> > Subject: Re: handling form based authentication w/ remember-me cookie
> > 
> > 
> > Dipak,
> > 
> > Are you certain that the filter will be invoked on the /j_security_check
> > request when container-based security is used? I have not tested this, but
> > it would not surprise me to find that some containers do not execute
> filters
> > on /j_security_check requests. I don't know if the Servlet Spec says
> > anything about this case.
> > 
> > Chris,
> > 
> > Another alternative to the original problem of security with "remember me"
> > functionality will be available soon. A patch has been submitted to my
> > SecurityFilter project (http://www.securityfilter.org/) to support
> "remember
> > me" functionality. The integration should be complete soon, and a beta
> > release will be made available once the integration is complete.
> > SecurityFilter works very much like container-managed security otherwise,
> > including the configuration format (except that you declare the
> constraints
> > in a separate config file rather than web.xml).
> > 
> > -Max
> > 
> > - Original Message -
> > From: "Parmar, Dipakkumar" <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > Sent: Monday, January 12, 2004 7:43 AM
> > Subject: RE: handling form based authentication w/ remember-me cookie
> > 
> > 
> > > Hi Chris,
> > >
> > > You can do this using Servlet Filter.  What you need to do is write
> > > postLoginFilter that maps to the j_security_check url.
> > >
> > > In doFilter method, you can write your post login code after
> > > j_security_check done is work.
> > >
> > > Something like:
> > > public void doFilter(.)
> > >
> > > // let the j_security_check to do it's work
> > > chain.doFilter(request, response)
> > >
> > > // do you post login stuff here
> > >
> > > Regards,
> > > Dipak Parmar
> > >
> > >
> > >
> > > -Original Message-
> > > From: Chris Ruegger [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, January 12, 2004 9:53 AM
> > > To: Struts Users Mailing List
> > > Subject: handling form based authentication w/ remember-me cookie
> > >
> > >
> > > I am using Struts and building a logon page to do Form-based
> > authentication
> > > under Tomcat. I want to also have a checkbox for the user to check that
> > says
> > > "remember me" so that I can send them a cookie.  I'm not sure how to
> > > "intercept"
> > > the form values because I have to post to j_security_check. How can I
> get
> > > the
> > > check-box value, set up the cookie, and send them to j_security_check
> with
> > > struts?
> > >
> > > Thanks
> > >
> > >
> > > -
> > > 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]
> > 
> > 
> 
> 
> 
> -
> 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: redirecting to fully qualified hostname

2004-01-13 Thread Brice Ruth
What you're likely running into is the fact that the cookie that the 
application server uses to track a user's session object, is very 
specific to what host can read the cookie.

I use Apache and one of the things I've done is set a configuration 
parameter "UseCanonicalName" to be "on" - it defaults to "off" ... 
here's the comment in Apache's configuration that describes this parameter:

#
# UseCanonicalName: Determines how Apache constructs self-referencing
# URLs and the SERVER_NAME and SERVER_PORT variables.
# When set "Off", Apache will use the Hostname and Port supplied
# by the client.  When set "On", Apache will use the value of the
# ServerName directive.
#
UseCanonicalName On
Basically, if you define your "host" instance in Tomcat to be 
host.domain.com, then regardless if someone accesses http://host/ or 
http://host.domain.com/, Apache will populate the SERVER_NAME variable 
with "host.domain.com" - what this does, is when Tomcat then figures out 
what server name to specify for the cookie, it will use 
"host.domain.com", not whatever the user tried to access the application 
through.

Help? Yes? No? Hope so!!

Fullam, Jonathan wrote:

All,

The application I am working on is secured with a login that required a
username and password.  Once a user is logged in, all pages can be accessed
as long as there is a Subject object in the Session.  My problem is that
part of the webapp provided links to pages that open in another window, and
when the link is clicked, it is forwarding to the logon page as if the
Subject object is no longer in the Session.  I've determined that this
behavior is only present when the hostname used for the request is not fully
qualified upon the intial logon.
For instance.

User logons on by going to http://serverName/webapp/logon.do

Then the application provides a link to
http://serverName.mycompany.com/webapp/something.do which open a page in a
new window.
When the user click the link, a new window is opened but they are forwarded
to the logon page as if they never logged on in the first place.
How can I have all requests to the original hostname
http://serverName/webapp be redirected to
http://serverName.mycompany.com/webapp ?  Is there anybody out there that
has experienced this or knows of a better way to work around this issue?
Thanks in Advance,
Jonathan
 

--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: New to struts, having an issue

2004-01-13 Thread Richard Hightower
I just saw your LOL. too funny I can't say I have never done anything
like that. Let's both get some sleep, we need it.



-Original Message-
From: Richard Hightower [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 13, 2004 3:34 PM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: RE: New to struts, having an issue


Conclusion:

Your execute method is getting called... it is the one throwing the
exception. (Or the exception gets thrown when it executes a helper object).

See... com.faid.qa.actions.viewDataAction.execute(viewDataAction.java:19)

Send the above line of code with surrounding code.


Thought process

Check the signature of you execute method. Perhaps the default execute
method is getting called.

Hmm.

I looked line 484 of the RequestProcessor (from the stack trace that you
sent).

protected ActionForward
processActionPerform(HttpServletRequest request,
 HttpServletResponse response,
 Action action,
 ActionForm form,
 ActionMapping mapping)
throws IOException, ServletException {

try {
return (action.execute(mapping, form, request, response)); //484
} catch (Exception e) {
return (processException(request, response,
 e, form, mapping));
}

}

It seems like it is trying to do the right thing.

H..

The default impl of the execute method is as follows:

public ActionForward execute(ActionMapping mapping,
 ActionForm form,
 ServletRequest request,
 ServletResponse response)
throws Exception {

// Call the deprecated method for backwards compatibility
return (perform(mapping, form, request, response));

}

As you can see it just calls the perform method.

The perform method(s) are no ops.

I searched the entire code base for the words... Method perform() not yet
implemented. Nothing!

Are you sure you are not subclassing a custom Action class?


Wait... I see... dag nabbit a closer inspection of the stack trace
reveals.

Conclusion:

Your execute method is getting called... it is the one throwing the
exception.

com.faid.qa.actions.viewDataAction.execute(viewDataAction.java:19)

Send the above line of code with surrounding code.


Rick Hightower
Developer

Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm

Struts/J2EE consulting --
http://www.arc-mind.com/consulting.htm#StrutsMentoring

-Original Message-
From: Bret Kumler [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 13, 2004 3:10 PM
To: Struts Users Mailing List
Subject: New to struts, having an issue


Guys.

I'm using JBOSS 3.2.3, struts 1.1.

When I try to execute my action I get the following on my server stdout.

I thought this was depricated and to use execute()

java.lang.UnsupportedOperationException: Method perform() not yet
implemented.
at
com.faid.qa.actions.viewDataAction.execute(viewDataAction.java:19)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProces
sor.java:484)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:256)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrR
ealm.java:220)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
46)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.jboss.web.tomcat.tc4.statistics.ContainerStatsVa

RE: New to struts, having an issue

2004-01-13 Thread Richard Hightower
Conclusion:

Your execute method is getting called... it is the one throwing the
exception. (Or the exception gets thrown when it executes a helper object).

See... com.faid.qa.actions.viewDataAction.execute(viewDataAction.java:19)

Send the above line of code with surrounding code.


Thought process

Check the signature of you execute method. Perhaps the default execute
method is getting called.

Hmm.

I looked line 484 of the RequestProcessor (from the stack trace that you
sent).

protected ActionForward
processActionPerform(HttpServletRequest request,
 HttpServletResponse response,
 Action action,
 ActionForm form,
 ActionMapping mapping)
throws IOException, ServletException {

try {
return (action.execute(mapping, form, request, response)); //484
} catch (Exception e) {
return (processException(request, response,
 e, form, mapping));
}

}

It seems like it is trying to do the right thing.

H..

The default impl of the execute method is as follows:

public ActionForward execute(ActionMapping mapping,
 ActionForm form,
 ServletRequest request,
 ServletResponse response)
throws Exception {

// Call the deprecated method for backwards compatibility
return (perform(mapping, form, request, response));

}

As you can see it just calls the perform method.

The perform method(s) are no ops.

I searched the entire code base for the words... Method perform() not yet
implemented. Nothing!

Are you sure you are not subclassing a custom Action class?


Wait... I see... dag nabbit a closer inspection of the stack trace
reveals.

Conclusion:

Your execute method is getting called... it is the one throwing the
exception.

com.faid.qa.actions.viewDataAction.execute(viewDataAction.java:19)

Send the above line of code with surrounding code.


Rick Hightower
Developer

Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm

Struts/J2EE consulting --
http://www.arc-mind.com/consulting.htm#StrutsMentoring

-Original Message-
From: Bret Kumler [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 13, 2004 3:10 PM
To: Struts Users Mailing List
Subject: New to struts, having an issue


Guys.

I'm using JBOSS 3.2.3, struts 1.1.

When I try to execute my action I get the following on my server stdout.

I thought this was depricated and to use execute()

java.lang.UnsupportedOperationException: Method perform() not yet
implemented.
at
com.faid.qa.actions.viewDataAction.execute(viewDataAction.java:19)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProces
sor.java:484)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:256)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrR
ealm.java:220)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
46)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStat
sValve.java:76)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
a

Re: New to struts, having an issue

2004-01-13 Thread David Erickson
Bret,
I'm using execute in all of my actions.  You are implementing the execute
action properly in your viewDataAction action class correct?  Also you are
properly extending Action?  Posting some source code might help.
-David

- Original Message - 
From: "Bret Kumler" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, January 13, 2004 3:09 PM
Subject: New to struts, having an issue


> Guys.
>
> I'm using JBOSS 3.2.3, struts 1.1.
>
> When I try to execute my action I get the following on my server stdout.
>
> I thought this was depricated and to use execute()
>
> java.lang.UnsupportedOperationException: Method perform() not yet
> implemented.
> at
> com.faid.qa.actions.viewDataAction.execute(viewDataAction.java:19)
> at
>
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProces
> sor.java:484)
> at
>
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
> at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
> at
> org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:247)
> at
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:193)
> at
>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
> va:256)
> at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(StandardPipeline.java:643)
> at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> at
>
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
> va:191)
> at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(StandardPipeline.java:643)
> at
>
org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrR
> ealm.java:220)
> at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(StandardPipeline.java:641)
> at
>
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
> 46)
> at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(StandardPipeline.java:641)
> at
>
org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStat
> sValve.java:76)
> at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(StandardPipeline.java:641)
> at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> at
> org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
> at
>
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
> )
> at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(StandardPipeline.java:643)
> at
>
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
> java:171)
> at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(StandardPipeline.java:641)
> at
>
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
> )
> at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(StandardPipeline.java:641)
> at
>
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssoci
> ationValve.java:65)
> at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(StandardPipeline.java:641)
> at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
> at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(StandardPipeline.java:641)
> at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> at
>
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
> :174)
> at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(StandardPipeline.java:643)
> at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> at
> org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.

RE: New to struts, having an issue

2004-01-13 Thread Bret Kumler
Nevermind.

LOL I forgot to remove the throw exception..

DUHH

-Original Message-
From: Bret Kumler [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 13, 2004 2:10 PM
To: Struts Users Mailing List
Subject: New to struts, having an issue


Guys.

I'm using JBOSS 3.2.3, struts 1.1.

When I try to execute my action I get the following on my server stdout.

I thought this was depricated and to use execute()

java.lang.UnsupportedOperationException: Method perform() not yet
implemented.
at
com.faid.qa.actions.viewDataAction.execute(viewDataAction.java:19)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProces
sor.java:484)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:256)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrR
ealm.java:220)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
46)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStat
sValve.java:76)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:171)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssoci
ationValve.java:65)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:549)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:677)
at java.lang.Thread.run(Thread.java:536)



---

New to struts, having an issue

2004-01-13 Thread Bret Kumler
Guys.

I'm using JBOSS 3.2.3, struts 1.1.

When I try to execute my action I get the following on my server stdout.

I thought this was depricated and to use execute()

java.lang.UnsupportedOperationException: Method perform() not yet
implemented.
at
com.faid.qa.actions.viewDataAction.execute(viewDataAction.java:19)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProces
sor.java:484)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:256)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrR
ealm.java:220)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
46)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStat
sValve.java:76)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:171)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssoci
ationValve.java:65)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:549)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:677)
at java.lang.Thread.run(Thread.java:536)


RE: REQUEST_PROCESSOR - couldn't deserialize

2004-01-13 Thread Gopalakrishnan, Jayesh
Yes, the offending class seems to be the Struts RequestProcessor.



-Original Message-
From: Leticia Golubov [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 13, 2004 2:26 AM
To: Struts Users Mailing List
Subject: RE: REQUEST_PROCESSOR - couldn't deserialize


I've had a similar problem before when the offending class did not implement
java.io.Serializable...

regards

Leticia

-Original Message-
From: Gopalakrishnan, Jayesh [mailto:[EMAIL PROTECTED]
Sent: 12 January 2004 18:54
To: Struts Users Mailing List
Subject: REQUEST_PROCESSOR - couldn't deserialize


Has anybody encountered this exception...?

   
<[ServletContext(id=158851062,name=stap-portal,context-path=/stap-portal)]
could not deserialize the context attribute
"org.apache.struts.action.REQUEST_PROCESSOR"
java.io.NotSerializableException:org.apache.struts.tiles.TilesRequestProcess
or
   at
java.io.ObjectOutputStream.writeObject0(Ljava.lang.Object;Z)V(Unknown
Source)
   at
java.io.ObjectOutputStream.writeObject(Ljava.lang.Object;)V(Unknown Source)
   at
weblogic.servlet.internal.AttributeWrapper.getObject(Z)Ljava.lang.Object;(At
tributeWrapper.java:95)
   at
weblogic.servlet.internal.AttributeWrapper.getObject()Ljava.lang.Object;(Att
ributeWrapper.java:67)
   at
weblogic.servlet.internal.WebAppServletContext.getAttribute(Ljava.lang.Strin
g;)Ljava.lang.Object;(WebAppServletContext.java:637)
   at
org.apache.struts.action.ActionServlet.getRequestProcessor(Lorg.apache.strut
s.config.ModuleConfig;)Lorg.apache.struts.action.RequestProcessor;(ActionSer

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



redirecting to fully qualified hostname

2004-01-13 Thread Fullam, Jonathan
All,

The application I am working on is secured with a login that required a
username and password.  Once a user is logged in, all pages can be accessed
as long as there is a Subject object in the Session.  My problem is that
part of the webapp provided links to pages that open in another window, and
when the link is clicked, it is forwarding to the logon page as if the
Subject object is no longer in the Session.  I've determined that this
behavior is only present when the hostname used for the request is not fully
qualified upon the intial logon.

For instance.

User logons on by going to http://serverName/webapp/logon.do

Then the application provides a link to
http://serverName.mycompany.com/webapp/something.do which open a page in a
new window.

When the user click the link, a new window is opened but they are forwarded
to the logon page as if they never logged on in the first place.

How can I have all requests to the original hostname
http://serverName/webapp be redirected to
http://serverName.mycompany.com/webapp ?  Is there anybody out there that
has experienced this or knows of a better way to work around this issue?

Thanks in Advance,
Jonathan


RE: ActionForm - redirect to custom JSP after validation failed

2004-01-13 Thread Christian Schlaefcke
Thank you for your advices! That helped improving my understanding of
struts alot! At first glance I like the aproach with "validate=false" and
calling the validate method myself in the LoginAction class, so I have the
control when to validate.

Regards,

Chris

> I generally like to stay away from using login.jsp AND a failure.jsp.
> Mainly
> because its two different pages to maintain, when they look very similar.
>
> So use just login.jsp for both just simple login, and failure.
>
> I would suggest that in your DisplayLoginAction or similar, set a request
> attribute like isDisplayLogin that tells you that it is not a failure. If
> after validation failture you are being forwarded to login.jsp ,
> isDisplayLogin will not be set. Now you can render the jsp with your
> failure
> stuff.
>
> I am not a Struts expert, but my feeling is that you SHOULD be checking if
> user has entered login and password, but you SHOULD NOT be checking if
> that
> combination is right in the FormBean. That SHOULD be done in the Action,
> so
> you can decide what to do next..
>
> My authentication filter is not implemented using struts, so I don't use
> the
> above scenario myself, yet.
>
> My 2 cents..
>
> Pritpal Dhaliwal
>
>
> -Original Message-
> From: Richard Hightower [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, January 13, 2004 9:20 AM
> To: Struts Users Mailing List; [EMAIL PROTECTED]
> Subject: RE: ActionForm - redirect to custom JSP after validation failed
>
>
> First, the behavior experiencing is as designed. I suggest getting a good
> book on Struts geared for Struts novices like Professional Struts
> published
> by Wrox (written by James Goodwill and me).
>
> You can turn validation off in the action mapping (action element in the
> struts config file) by setting the validate attribute to false (the
> default
> is true).
>
> That said
>
> Here is what I would do (and have done in a similar situation).
>
> Turn validation off by setting validate=false on the action mapping:
>
>  type="buy.my.book.FooAction">
>
>
>
>
> Have the action's execute method calll the validation method of the
> ActionForm, then forward to anywhere you would like.
>
> ActionErrors errors = form.validate();
>
> //if errors not empty forward to failure
> return mapping.findForward("failure");
>
>
> Rick Hightower
> Developer
>
> Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm
>
> Struts/J2EE consulting --
> http://www.arc-mind.com/consulting.htm#StrutsMentoring
>
> -Original Message-
> From: Christian Schlaefcke [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, January 13, 2004 9:27 AM
> To: [EMAIL PROTECTED]
> Subject: ActionForm - redirect to custom JSP after validation failed
>
>
> Hi Folks,
>
> I have a simple login.jsp that I want to validate. So I have a Class
> "LoginForm" with a "validate" method, that fills up the ActionErrors with
> the errors that might occur (missing username/password, wrong
> username/password). Later the execute method of the corresponding Action
> class "LoginAction" checks those ActionErrors. If not empty I try to
> return
> a forward to "failure.jsp".
>
> The problem I have is that before my LoginAction could execute my custom
> forward the RequestProcessor of Struts tells in the logs, that validation
> has failed and request will be forwarded to /login.jsp (which is of course
> the input item of this action in struts-config.xml). When a validation
> error
> occurs my LoginAction class is never called.
>
> I searched the archive of this list already but couldn´t get through the
> solutions I found there. I still don´t understand why this is happening
> and
> what I can do to redirect to a custom failure.jsp.
>
> Could someone please explain in newbie-style ;-) ?
>
> Thanks & Regards!
>
> Chris
>
> -
> 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]
>
>
>
> -
> 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: Bothersome BeanUtils.populate exception

2004-01-13 Thread Mark Lowe
Don't know how i had it working before but does now. Thanks man..

Still don't agree about the messages vs errors ;o) Although I agree 
that tags belong in jsp's.

Thanks again Mark

On 13 Jan 2004, at 18:49, Richard Hightower wrote:

Change colors property to use a regular array.

-Original Message-
From: Mark Lowe [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 13, 2004 11:06 AM
To: Richard Hightower
Cc: Struts Users Mailing List
Subject: Re: Bothersome BeanUtils.populate exception


Hi Richard

Here are the summarized bits

public ArrayList getColours() {
return colourList;
}
public void setColours(ArrayList colourList) {
this.colourList = colourList;
}
//

ProductForm theForm = (ProductForm) form;

theForm.setColours(colourList);
...



Everything works (the select menus select the correct values etc, but
then when i submit i get the bean utils illegal argument exception.
This worked pretty much in the same way before. Hopefully I'm just
missing something simple.
here are my mappings also.

Cheers mark













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


Re: mapping question

2004-01-13 Thread Daniel H. F. e Silva
Vanessa,

  As discussed a time ago on this list, it is considered a best pratice
to go through an action all the time. So you can decouple your view layer
in a way that makes your life easier. There are plenty of learning resources
around the Internet about Struts, but i'd like to recommend www.reumann.net
and www.ibatis.com. iBATIS is where you'll find a nice implementation of PetStore
sample application that could be useful as a starting point to your apps.

Cheers,
 Daniel Silva.

PS: If you need help during your day you could go to #struts_users IRC channel at 
irc.darkmyst.org
You'll meet nice people and very skilled java and struts developers there.

--- Vanessa Monteiro <[EMAIL PROTECTED]> wrote:
> Hello everyone,
> 
> I'm having trouble understanding the mapping tags of
> struts-config.xml.
> 
> I have one simple jsp form and one form and one action to take care of
> it. In my /pages/form.jsp I have a  
> My action-mapping is path=/action and I'm putting no input value. So to
> get to my form I link to /pages/form.jsp or do I need and action to
> point to the unsubmitted form?
> 
> Vanessa.
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


__
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

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



Re: handling form based authentication w/ remember-me cookie

2004-01-13 Thread cruegger

Are Servlet filters supposed to be called for both GET and POST
methods? They seem to be getting called for GETs only on Tomcat 5.
-Chris


> -Original Message-
> From: Parmar, Dipakkumar [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, January 13, 2004 03:57 PM
> To: 'Struts Users Mailing List'
> Subject: RE: handling form based authentication w/ remember-me cookie
> 
> Hi Max,
> 
> I haven't tested it either.  I read it about this in "IBM WebSphere V5.0
> Security handbook (page 64)".
> 
> Regards,
> Dipak Parmar
> 
> 
> -Original Message-
> From: Max Cooper [mailto:[EMAIL PROTECTED]
> Sent: Monday, January 12, 2004 10:42 PM
> To: Struts Users Mailing List; [EMAIL PROTECTED]
> Subject: Re: handling form based authentication w/ remember-me cookie
> 
> 
> Dipak,
> 
> Are you certain that the filter will be invoked on the /j_security_check
> request when container-based security is used? I have not tested this, but
> it would not surprise me to find that some containers do not execute filters
> on /j_security_check requests. I don't know if the Servlet Spec says
> anything about this case.
> 
> Chris,
> 
> Another alternative to the original problem of security with "remember me"
> functionality will be available soon. A patch has been submitted to my
> SecurityFilter project (http://www.securityfilter.org/) to support "remember
> me" functionality. The integration should be complete soon, and a beta
> release will be made available once the integration is complete.
> SecurityFilter works very much like container-managed security otherwise,
> including the configuration format (except that you declare the constraints
> in a separate config file rather than web.xml).
> 
> -Max
> 
> - Original Message -
> From: "Parmar, Dipakkumar" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Monday, January 12, 2004 7:43 AM
> Subject: RE: handling form based authentication w/ remember-me cookie
> 
> 
> > Hi Chris,
> >
> > You can do this using Servlet Filter.  What you need to do is write
> > postLoginFilter that maps to the j_security_check url.
> >
> > In doFilter method, you can write your post login code after
> > j_security_check done is work.
> >
> > Something like:
> > public void doFilter(.)
> >
> > // let the j_security_check to do it's work
> > chain.doFilter(request, response)
> >
> > // do you post login stuff here
> >
> > Regards,
> > Dipak Parmar
> >
> >
> >
> > -Original Message-
> > From: Chris Ruegger [mailto:[EMAIL PROTECTED]
> > Sent: Monday, January 12, 2004 9:53 AM
> > To: Struts Users Mailing List
> > Subject: handling form based authentication w/ remember-me cookie
> >
> >
> > I am using Struts and building a logon page to do Form-based
> authentication
> > under Tomcat. I want to also have a checkbox for the user to check that
> says
> > "remember me" so that I can send them a cookie.  I'm not sure how to
> > "intercept"
> > the form values because I have to post to j_security_check. How can I get
> > the
> > check-box value, set up the cookie, and send them to j_security_check with
> > struts?
> >
> > Thanks
> >
> >
> > -
> > 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]
> 
> 



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



Tag library versioning

2004-01-13 Thread Barnett, Brian W.
I'm a little confused on how tab library versioning works. When I run my
Struts web app, the resin console fills up with SAXCompileExceptions,
complaining about " is an unexpected element" and "
is expected", etc., etc. My app seems to run fine, but I'd like to resolve
this issue.  Not sure what to. Can someone give me some guidance here?

 

Thanks.

 



Re: Multiple Beans one Action

2004-01-13 Thread Mark Lowe
you can store one in the session,

FirstForm beanA = (FIrstForm) form;
SecondForm beanB = (SecondForm) session.getAttribute("beanB");
Or nest beanB in beanA or vice versa.

On 13 Jan 2004, at 18:56, Eric C wrote:

Hello all and happy new year,

suppose I have 2 beans one beanA extends Action Form, the other beanB
extends ValidatorForm. I have one Action class which needs data from 
both
beans. How can I do that ?

Regards,
ERic
-
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: Multiple Beans one Action

2004-01-13 Thread Wendy Smoak
> From: Eric C [mailto:[EMAIL PROTECTED] 
> suppose I have 2 beans one beanA extends Action Form, the other beanB
> extends ValidatorForm. I have one Action class which needs 
> data from both
> beans. How can I do that ?

AFAIK Struts is only going to populate one Form bean from one request.
But if your forms are session scoped you can retrieve any of them in the
Action code with session.getAttribute().

Not knowing a thing about your design, is it possible that this is one
of those apps that would benefit from having a single big Form bean with
all the properties, and then each HTML form may only use a subset?

-- 
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management 

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



RE: Using ArrayList instead of String[] properties

2004-01-13 Thread Michael McGrady
Hi, Wendy,

Just do this or whatever is similar that you like.  This is what I do.

public class ArrayListWrapper
extends ArrayList {
  private ArrayListWrapper(Object [] param) {
for(int i = 0; i < param.length; i++) {
  this.add(param[i]);
}
  }
  public static ArrayList getInstance(Object [] param) {
return new ArrayListWrapper(param);
  }
}
At 09:47 AM 1/13/2004, Wendy Smoak wrote:
> From: Mark Lowe [mailto:[EMAIL PROTECTED]
> It was working, until i rearranged a few things. A few
> questions/suggestions in help me problem solve would be greatly
> appreciated if you have the time.
I also don't see why BeanUtils can't handle turning multiple request
parameters with the same name into an ArrayList.  It *seems* like it
should work.
String[] works fine for me, though.  I actually thought there was a
one-liner to turn a String[] into an ArrayList of Strings, but I was
mistaken-- Arrays.asList() only produces a fixed-length list.  You can
change values, but you can't add a value to the array-backed-List.  My
"issue" is probably not one that you have-- I need to accept input from
three text areas and manually add the concatenated text to the String[]
property.
It would be nicer to do it with myList.add( "stuff" ), but since I can't
get ArrayList to work, here's how I'm using String[] in Action code:
  DynaActionForm dForm = (DynaActionForm) form;
  String[] accounts = (String[]) dForm.get( "accounts" );
  String fund = dForm.getString( "fund" );
  String function = dForm.getString( "function" );
  String costCenter = dForm.getString( "costCenter" );
  String[] newArray = new String[ accounts.length + 1];
  System.arraycopy( accounts, 0, newArray, 0, accounts.length );
  newArray[ newArray.length - 1 ] =
fund+"_"+function+"_"+costCenter;
  dForm.set( "accounts" , newArray );
  accounts = null;
  return mapping.findForward( "advanced" );
I haven't used arrays in ages, so if someone is now ROFL at my
incredibly inefficient code, please enlighten me.
--
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Multiple Beans one Action

2004-01-13 Thread Eric C
Hello all and happy new year,

suppose I have 2 beans one beanA extends Action Form, the other beanB
extends ValidatorForm. I have one Action class which needs data from both
beans. How can I do that ?

Regards,
ERic


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



Re: Bothersome BeanUtils.populate exception

2004-01-13 Thread Mark Lowe
Additionally i don't get the exception when i remove sizes and colours  
from the form, as i was getting mystical bean utils errors I started  
doing split half debugging like one does with javascript.

Everything's fine except for these properties. As I said before I've  
had this working in this way, there just must be something that i'm  
missed (although I'm fecked if i can see it).

My guess us that the exception happens when struts creates a dynabean  
from my action form, and/or attempts to populate the form based on the  
information it gets about the bean. But my types match as far as i can  
see.

The only thing i thought it could have been was stuff being stored as  
objects in the arraylist, I've had this working for weeks with  
arraylists.

I've updated beanutils in case that was the issue and googled for other  
folks with the same problem . to no avail.

On 13 Jan 2004, at 18:06, Mark Lowe wrote:

Hi Richard

Here are the summarized bits

public ArrayList getColours() {
return colourList;
}
public void setColours(ArrayList colourList) {
this.colourList = colourList;
}
//

ProductForm theForm = (ProductForm) form;

theForm.setColours(colourList);
...



Everything works (the select menus select the correct values etc, but  
then when i submit i get the bean utils illegal argument exception.

This worked pretty much in the same way before. Hopefully I'm just  
missing something simple.

here are my mappings also.

Cheers mark

		
			
		
		
			
		




On 13 Jan 2004, at 17:31, Richard Hightower wrote:
I have an idea, but would like to see your html:form and ActionForm  
before I
ruin my reputation with a bad mojo answer.

Send them directly to me and copy this list.

Rick Hightower
Developer
Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm

Struts/J2EE consulting --
http://www.arc-mind.com/consulting.htm#StrutsMentoring
-Original Message-
From: Mark Lowe [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 13, 2004 7:18 AM
To: Struts Users Mailing List
Subject: Bothersome BeanUtils.populate exception
beanUtils keeps getting its knickers in a twist when i submit a form
with 2 select menus with multiple values. I've had this working before
with the same version of struts and commons. Its not the action as the
exception is thrown before i get that far, when i remove the menus the
form submits fine.
I have form properties of type arrayList. I;d expect this exception if
i were to be using unsupported types but I've been setting the values
with  String and the form properties are also of type string.
I have trouble believing that bean utils has an issue with converting
Object to String when the values are copied.
The exception is a typical beanutils chocolate fire guard exception.  
If
i weren't using strings i'd understand but i am.

Any insights welcomed.

java.lang.IllegalArgumentException: argument type mismatch
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
Method)
 at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j 
av
a:39)
 at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess 
or
Impl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:324)
 at
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyU 
ti
ls.java:1789)
 at
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyU 
ti
ls.java:1684)
 at
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.j 
av
a:1713)
 at
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java: 
1019)
 at
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)

-
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]
-
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: ActionForm - redirect to custom JSP after validation failed

2004-01-13 Thread Dhaliwal, Pritpal (HQP)
I generally like to stay away from using login.jsp AND a failure.jsp. Mainly
because its two different pages to maintain, when they look very similar.

So use just login.jsp for both just simple login, and failure.

I would suggest that in your DisplayLoginAction or similar, set a request
attribute like isDisplayLogin that tells you that it is not a failure. If
after validation failture you are being forwarded to login.jsp ,
isDisplayLogin will not be set. Now you can render the jsp with your failure
stuff. 

I am not a Struts expert, but my feeling is that you SHOULD be checking if
user has entered login and password, but you SHOULD NOT be checking if that
combination is right in the FormBean. That SHOULD be done in the Action, so
you can decide what to do next..

My authentication filter is not implemented using struts, so I don't use the
above scenario myself, yet.

My 2 cents..

Pritpal Dhaliwal


-Original Message-
From: Richard Hightower [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 13, 2004 9:20 AM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: RE: ActionForm - redirect to custom JSP after validation failed


First, the behavior experiencing is as designed. I suggest getting a good
book on Struts geared for Struts novices like Professional Struts published
by Wrox (written by James Goodwill and me).

You can turn validation off in the action mapping (action element in the
struts config file) by setting the validate attribute to false (the default
is true).

That said

Here is what I would do (and have done in a similar situation).

Turn validation off by setting validate=false on the action mapping:






Have the action's execute method calll the validation method of the
ActionForm, then forward to anywhere you would like.

ActionErrors errors = form.validate();

//if errors not empty forward to failure
return mapping.findForward("failure");


Rick Hightower
Developer

Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm

Struts/J2EE consulting --
http://www.arc-mind.com/consulting.htm#StrutsMentoring

-Original Message-
From: Christian Schlaefcke [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 13, 2004 9:27 AM
To: [EMAIL PROTECTED]
Subject: ActionForm - redirect to custom JSP after validation failed


Hi Folks,

I have a simple login.jsp that I want to validate. So I have a Class
"LoginForm" with a "validate" method, that fills up the ActionErrors with
the errors that might occur (missing username/password, wrong
username/password). Later the execute method of the corresponding Action
class "LoginAction" checks those ActionErrors. If not empty I try to return
a forward to "failure.jsp".

The problem I have is that before my LoginAction could execute my custom
forward the RequestProcessor of Struts tells in the logs, that validation
has failed and request will be forwarded to /login.jsp (which is of course
the input item of this action in struts-config.xml). When a validation error
occurs my LoginAction class is never called.

I searched the archive of this list already but couldn´t get through the
solutions I found there. I still don´t understand why this is happening and
what I can do to redirect to a custom failure.jsp.

Could someone please explain in newbie-style ;-) ?

Thanks & Regards!

Chris

-
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]



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



Re: Exception Handling

2004-01-13 Thread Henrique VIECILI
Hi, i figured out the answer!

i changed the scope in the global exceptions declaration to session instead of
request.

sometimes some atributes in request scope simply disapear, *weird*

Henrique

- Original Message -
From: "Henrique VIECILI" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, January 13, 2004 3:23 PM
Subject: Exception Handling


> Hi,
>
> can anyone explain why :
>
> 
>
> prints "mypackage.Exception: cause"; and
>
> <% anyscope.getAttribute("org.apache.struts.action.EXCEPTION").toString(); %>
>
> prints "null" ??
>
> Henrique Viecili
>
> -
> 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: Using ArrayList instead of String[] properties

2004-01-13 Thread Mark Lowe
The only issue with using arraylist as a form property is to scope to 
session so you can change the size when required. I tend to use them 
for nesting beans rather then just storing strings.

My form parameters are in an arraylist. I just think beanUtils hates me 
or something rational like that.

On 13 Jan 2004, at 17:47, Wendy Smoak wrote:

From: Mark Lowe [mailto:[EMAIL PROTECTED]
It was working, until i rearranged a few things. A few
questions/suggestions in help me problem solve would be greatly
appreciated if you have the time.
I also don't see why BeanUtils can't handle turning multiple request
parameters with the same name into an ArrayList.  It *seems* like it
should work.
String[] works fine for me, though.  I actually thought there was a
one-liner to turn a String[] into an ArrayList of Strings, but I was
mistaken-- Arrays.asList() only produces a fixed-length list.  You can
change values, but you can't add a value to the array-backed-List.  My
"issue" is probably not one that you have-- I need to accept input from
three text areas and manually add the concatenated text to the String[]
property.
It would be nicer to do it with myList.add( "stuff" ), but since I 
can't
get ArrayList to work, here's how I'm using String[] in Action code:

  DynaActionForm dForm = (DynaActionForm) form;
  String[] accounts = (String[]) dForm.get( "accounts" );
  String fund = dForm.getString( "fund" );
  String function = dForm.getString( "function" );
  String costCenter = dForm.getString( "costCenter" );
  String[] newArray = new String[ accounts.length + 1];
  System.arraycopy( accounts, 0, newArray, 0, accounts.length );
  newArray[ newArray.length - 1 ] =
fund+"_"+function+"_"+costCenter;
  dForm.set( "accounts" , newArray );
  accounts = null;
  return mapping.findForward( "advanced" );
I haven't used arrays in ages, so if someone is now ROFL at my
incredibly inefficient code, please enlighten me.
--
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management
-
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: Bothersome BeanUtils.populate exception

2004-01-13 Thread Mark Lowe
Hi Richard

Here are the summarized bits

public ArrayList getColours() {
return colourList;
}
public void setColours(ArrayList colourList) {
this.colourList = colourList;
}
//

ProductForm theForm = (ProductForm) form;

theForm.setColours(colourList);
...



Everything works (the select menus select the correct values etc, but 
then when i submit i get the bean utils illegal argument exception.

This worked pretty much in the same way before. Hopefully I'm just 
missing something simple.

here are my mappings also.

Cheers mark

		
			
		
		
			
		




//
//  ProductForm.java
//  murphynye
//
//  Created by Mark Lowe on Wed Dec 03 2003.
//  Copyright (c) 2003 BoxStuff Ltd. All rights reserved.
//
package com.boxstuff.shop.admin;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;
import org.apache.struts.upload.MultipartRequestHandler;
import org.apache.struts.util.MessageResources;
import org.apache.struts.validator.Resources;
import java.util.ArrayList;
import java.math.BigDecimal;
import java.io.ByteArrayInputStream;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
import java.util.Locale;
import java.util.Properties;
import com.boxstuff.struts.StockItemBean;
import java.util.HashMap;

public class ProductForm extends ActionForm {

private String id;
private String name;
private String code;
private Integer deptId;
private Integer catId;
private String desc;
private Integer stockLevelWarn;
private String buyPrice;
private String sellPrice;
private Integer sizeRangeId;
private ArrayList sizeList;
private ArrayList imageList;
private Integer stockWarning;
private Integer fabricId;
private String fabric;
private String department;
private String category;
private ArrayList colourList;
private FormFile imageFile;
private Integer imageType;
private Integer imageColour;
private HashMap stockItemQuantities = new HashMap();
private String salePrice;

public ProductForm() {
this.imageList = new ArrayList();
this.colourList = new ArrayList();
this.sizeList = new ArrayList();
}

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}


/** name */
public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

/** code */
public String getCode() {
return code;
}

public void setCode(String code) {
this.code = code;
}

/** deptId */
public Integer getDepartmentId() {
return deptId;
}

public void setDepartmentId(Integer deptId) {
this.deptId = deptId;
}

/** catId */
public Integer getCategoryId() {
return catId;
}

public void setCategoryId(Integer catId) {
this.catId = catId;
}

public String getCategory() {
return category;
}

public void setCategory(String category) {
this.category = category;
}

public String getDepartment() {
return department;
}

public void setDepartment(String department) {
this.department = department;
}


/** desc */
public String getDescription() {
return desc;
}

public void setDescription(String desc) {
this.desc = desc;
}

/** imageList */
public Object[] getImages() {
return imageList.toArray();
}

public void setImages(ArrayList imageList) {
this.imageList = imageList;
}

public FormFile getImage() {
return imageFile;
}

public void setImage(FormFile imageFile) {
this.imageFile = imageFile;
}



/** sizeRangeId */
public Integer getSizeRange() {
return sizeRangeId;
}

public void setSizeRange(Integer sizeRangeId) {
this.sizeRangeId = sizeRangeId;
}

/** sellPrice */
public String getSellPrice() {
return sellPrice;
}

RE: Using ArrayList instead of String[] properties

2004-01-13 Thread Kris Schneider
For a resizable list from an array, try:

List stringList = new ArrayList(Arrays.asList(stringArray));

Quoting Wendy Smoak <[EMAIL PROTECTED]>:

> > From: Mark Lowe [mailto:[EMAIL PROTECTED] 
> > It was working, until i rearranged a few things. A few 
> > questions/suggestions in help me problem solve would be greatly 
> > appreciated if you have the time.
> 
> I also don't see why BeanUtils can't handle turning multiple request
> parameters with the same name into an ArrayList.  It *seems* like it
> should work.
> 
> String[] works fine for me, though.  I actually thought there was a
> one-liner to turn a String[] into an ArrayList of Strings, but I was
> mistaken-- Arrays.asList() only produces a fixed-length list.  You can
> change values, but you can't add a value to the array-backed-List.  My
> "issue" is probably not one that you have-- I need to accept input from
> three text areas and manually add the concatenated text to the String[]
> property.  
> 
> It would be nicer to do it with myList.add( "stuff" ), but since I can't
> get ArrayList to work, here's how I'm using String[] in Action code:
> 
>   DynaActionForm dForm = (DynaActionForm) form;
>   String[] accounts = (String[]) dForm.get( "accounts" );
>   String fund = dForm.getString( "fund" );
>   String function = dForm.getString( "function" );
>   String costCenter = dForm.getString( "costCenter" );
>   String[] newArray = new String[ accounts.length + 1];
>   System.arraycopy( accounts, 0, newArray, 0, accounts.length );
>   newArray[ newArray.length - 1 ] =
> fund+"_"+function+"_"+costCenter;
>   dForm.set( "accounts" , newArray );
>   accounts = null;
>   return mapping.findForward( "advanced" );
> 
> I haven't used arrays in ages, so if someone is now ROFL at my
> incredibly inefficient code, please enlighten me.
> 
> -- 
> Wendy Smoak
> Application Systems Analyst, Sr.
> ASU IA Information Resources Management 

-- 
Kris Schneider 
D.O.Tech   

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



RE: Using ArrayList instead of String[] properties

2004-01-13 Thread Wendy Smoak
> From: Mark Lowe [mailto:[EMAIL PROTECTED] 
> It was working, until i rearranged a few things. A few 
> questions/suggestions in help me problem solve would be greatly 
> appreciated if you have the time.

I also don't see why BeanUtils can't handle turning multiple request
parameters with the same name into an ArrayList.  It *seems* like it
should work.

String[] works fine for me, though.  I actually thought there was a
one-liner to turn a String[] into an ArrayList of Strings, but I was
mistaken-- Arrays.asList() only produces a fixed-length list.  You can
change values, but you can't add a value to the array-backed-List.  My
"issue" is probably not one that you have-- I need to accept input from
three text areas and manually add the concatenated text to the String[]
property.  

It would be nicer to do it with myList.add( "stuff" ), but since I can't
get ArrayList to work, here's how I'm using String[] in Action code:

  DynaActionForm dForm = (DynaActionForm) form;
  String[] accounts = (String[]) dForm.get( "accounts" );
  String fund = dForm.getString( "fund" );
  String function = dForm.getString( "function" );
  String costCenter = dForm.getString( "costCenter" );
  String[] newArray = new String[ accounts.length + 1];
  System.arraycopy( accounts, 0, newArray, 0, accounts.length );
  newArray[ newArray.length - 1 ] =
fund+"_"+function+"_"+costCenter;
  dForm.set( "accounts" , newArray );
  accounts = null;
  return mapping.findForward( "advanced" );

I haven't used arrays in ages, so if someone is now ROFL at my
incredibly inefficient code, please enlighten me.

-- 
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management 

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



RE: ActionForm LifeCycle (Maybe a bug in Struts)

2004-01-13 Thread Richard Hightower
Understanding the lifecycle of an ActionForm...

The ActionServlet handles requests for Struts, i.e., requests ending in *.do
is common. The ActionServlet looks up the RequestProcessor associated with
the module prefix. The RequestProcessor implements the handling of the
lifecycle and uses RequestUtils as a façade to Servlets scopes.

When a form gets submitted, Struts looks up the action-mappings for the
current request path from the ModuleConfig. The ModuleConfig is the object
manifestation of the struts-config.xml file, each module gets its own
ModuleConfig. (Recall that the action attribute in the html:form specifies
the path of the action to invoke.)

Struts locates the form-bean mapping from the action-mapping associated with
the request path. (This occurs in the processActionForm method of the
RequestProcessor by calling the createActionForm method of RequestUtils.)
If Struts does not find an ActionForm in the scope specified by the
action-mapping, it will create an instance of the ActionForm identified
form-bean mapping.

Struts populates the ActionForm by mapping the request parameters from the
HTML form variables to the JavaBean properties of the ActionForm instance.
Before it populates the form, Struts calls the reset method of the
ActionForm. (This occurs in the processPopulate method of the
RequestProcessor by calling the populate method of RequestUtils.)

If validation is required and is successful an instance of the Action class
execute method will be invoked. Validation is required if the validate
attribute of the action mapping is not false (the default is true). If
validation fails, control will be returned to the submitting form (the input
JSP) where the JSP form fields will be populated by the ActionForm. The
ActionForm is valid if the validate method returns null or an empty
ActionErrors collection. (This occurs in the processValidate method of the
RequestProcessor.)

The best way to understand the lifecycle is read the source code for the
RequestProcessor.

commnents below

Rick Hightower
Developer

Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm

Struts/J2EE consulting --
http://www.arc-mind.com/consulting.htm#StrutsMentoring


-Original Message-
From: Rodney Paul [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 13, 2004 2:47 AM
To: Struts Users Mailing List (E-mail)
Subject: ActionForm LifeCycle (Maybe a bug in Struts)


Hi All,

I was wondering if anyone knew what the lifecycle of an ActionForm is?
The reason I ask is in regards to the display of variables with a
.

I have noticed that the values displayed within a  are values
after a reset() method has been called,

*** The reset method gets called on each request. Your job is to populate
the form either in the reset method with default values or populate the
actionForm in an action and forward to the JSP page that has the html:form
to populate application specific (look up in a database).

and not after a validate method is called.

**Validate is for form submission not a mechanism to populate a form. You
are not using the validate method correctly.

Can anyone tell me the reason for this, as I seem to think this is a bug
within the Struts framework.

** Sorry. It is not. You need to get a good book on Struts I suggest
Professional Struts by James Goodwill and me. ;)


An example follows as to what I am talking about (based upon the following
ActionForm):


// Example ActionForm
public class MyActionForm extends ActionForm {
private String maximumDocuments = "3";
...// More variables


public MyActionForm() {
super();
System.out.println("Constructor called");
}



public void setMaximumDocuments(String maximumDocuments) {
this.maximumDocuments = maximumDocuments;
}

public String getMaximumDocuments() {
return maximumDocuments;
}
...// More get/set methods


public ActionErrors validate(ActionMapping actionMapping,
HttpServletRequest httpServletRequest) {
ActionErrors errors = new ActionErrors();

System.out.println("validate called");
System.out.println("before processing maximumDocuments: " +
maximumDocuments);

if(maximumDocuments == null) {
maximumDocuments = "50";// The supposed default value (if no
value entered)
}

 BAD MOJO

System.out.println("after processing maximumDocuments: " +
maximumDocuments);
...// Say an error has been returned
return errors;
}

public void reset(ActionMapping mapping, HttpServletRequest request) {
System.out.println("reset called");
System.out.println("before processing maximumDocuments: " +
this.maximumDocuments);

this.maximumDocuments   = "50";

System.out.println("after processign maximumDocuments: " +
this.maximumDocuments);
}
}



SCENARIOS:



-

RE: Bothersome BeanUtils.populate exception

2004-01-13 Thread Richard Hightower
I have an idea, but would like to see your html:form and ActionForm before I
ruin my reputation with a bad mojo answer.

Send them directly to me and copy this list.

Rick Hightower
Developer

Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm

Struts/J2EE consulting --
http://www.arc-mind.com/consulting.htm#StrutsMentoring

-Original Message-
From: Mark Lowe [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 13, 2004 7:18 AM
To: Struts Users Mailing List
Subject: Bothersome BeanUtils.populate exception


beanUtils keeps getting its knickers in a twist when i submit a form
with 2 select menus with multiple values. I've had this working before
with the same version of struts and commons. Its not the action as the
exception is thrown before i get that far, when i remove the menus the
form submits fine.

I have form properties of type arrayList. I;d expect this exception if
i were to be using unsupported types but I've been setting the values
with  String and the form properties are also of type string.

I have trouble believing that bean utils has an issue with converting
Object to String when the values are copied.

The exception is a typical beanutils chocolate fire guard exception. If
i weren't using strings i'd understand but i am.

Any insights welcomed.

java.lang.IllegalArgumentException: argument type mismatch
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
 at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:324)
 at
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUti
ls.java:1789)
 at
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUti
ls.java:1684)
 at
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.jav
a:1713)
 at
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
 at
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)


-
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]



Exception Handling

2004-01-13 Thread Henrique VIECILI
Hi,

can anyone explain why :

 

prints "mypackage.Exception: cause"; and

<% anyscope.getAttribute("org.apache.struts.action.EXCEPTION").toString(); %>

prints "null" ??

Henrique Viecili

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



Re: ActionForm - redirect to custom JSP after validation failed

2004-01-13 Thread Kris Schneider
If I understand what you're asking, try setting validate="false" in your action
mapping so that validation is deferred to your action. Otherwise, Struts will
perform validation automatically and, as you've noticed, never invoke your
action if there are errors.

Another option would be to keep validate="true" (that's actually it's default
value), but change input="/failure.jsp" (or wherever else you want to forward
upon validation errors - it can even be another action).

Quoting Christian Schlaefcke <[EMAIL PROTECTED]>:

> Hi Folks,
> 
> I have a simple login.jsp that I want to validate. So I have a Class
> "LoginForm" with a "validate" method, that fills up the ActionErrors with
> the errors that might occur (missing username/password, wrong
> username/password). Later the execute method of the corresponding Action
> class "LoginAction" checks those ActionErrors. If not empty I try to
> return a forward to "failure.jsp".
> 
> The problem I have is that before my LoginAction could execute my custom
> forward the RequestProcessor of Struts tells in the logs, that validation
> has failed and request will be forwarded to /login.jsp (which is of course
> the input item of this action in struts-config.xml). When a validation
> error occurs my LoginAction class is never called.
> 
> I searched the archive of this list already but couldn´t get through the
> solutions I found there. I still don´t understand why this is happening
> and what I can do to redirect to a custom failure.jsp.
> 
> Could someone please explain in newbie-style ;-) ?
> 
> Thanks & Regards!
> 
> Chris

-- 
Kris Schneider 
D.O.Tech   

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



RE: ActionForm - redirect to custom JSP after validation failed

2004-01-13 Thread Richard Hightower
First, the behavior experiencing is as designed. I suggest getting a good
book on Struts geared for Struts novices like Professional Struts published
by Wrox (written by James Goodwill and me).

You can turn validation off in the action mapping (action element in the
struts config file) by setting the validate attribute to false (the default
is true).

That said

Here is what I would do (and have done in a similar situation).

Turn validation off by setting validate=false on the action mapping:






Have the action's execute method calll the validation method of the
ActionForm, then forward to anywhere you would like.

ActionErrors errors = form.validate();

//if errors not empty forward to failure
return mapping.findForward("failure");


Rick Hightower
Developer

Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm

Struts/J2EE consulting --
http://www.arc-mind.com/consulting.htm#StrutsMentoring

-Original Message-
From: Christian Schlaefcke [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 13, 2004 9:27 AM
To: [EMAIL PROTECTED]
Subject: ActionForm - redirect to custom JSP after validation failed


Hi Folks,

I have a simple login.jsp that I want to validate. So I have a Class
"LoginForm" with a "validate" method, that fills up the ActionErrors with
the errors that might occur (missing username/password, wrong
username/password). Later the execute method of the corresponding Action
class "LoginAction" checks those ActionErrors. If not empty I try to
return a forward to "failure.jsp".

The problem I have is that before my LoginAction could execute my custom
forward the RequestProcessor of Struts tells in the logs, that validation
has failed and request will be forwarded to /login.jsp (which is of course
the input item of this action in struts-config.xml). When a validation
error occurs my LoginAction class is never called.

I searched the archive of this list already but couldn´t get through the
solutions I found there. I still don´t understand why this is happening
and what I can do to redirect to a custom failure.jsp.

Could someone please explain in newbie-style ;-) ?

Thanks & Regards!

Chris

-
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: Transaction tokens

2004-01-13 Thread Richard Hightower
OK this is a bit of an Obligatory plug but

The "Professional Struts" book written by myself and James Goodwill covers
this step by step.
First it lists the steps. Then it breaks the code down by each step.

You will want to have you saveToken called just before the form loads for
the first time.

Here is a scaled down excerpt

To use a transaction token, follow these steps:
1.  Before you load the JavaServer Pages (JSP) page that has the html:form
tag on it, call saveToken inside an action.
2.  When the user submits the form, call isTokenValid and handle the form
only if the token is valid.

The first step is to call saveToken inside an action. To do this, you have
to make sure an action is called before the JSP page loads.

Let’s say you had an action mapping that was associated with the user
registration page as



The above just associated a JSP page with an action. Then any JSP page that
links to the input form would link to it like this:

User Registration

Therefore, no JSP links directly to /userRegistration.jsp. If this is the
case, you have been following the rules in the MVC chapter and it is easy to
start using transaction tokens.

Now let’s say that you want to make sure that the user cannot hit the back
button in the browser and submit the form twice. To do this, you must change
the action mapping associated with the input form to map to an action that
will call the saveToken method of Action:



  


Action’s saveToken method generates and saves a transaction token and puts
it in session scope under the key Globals.TRANSACTION_TOKEN_KEY. Think of a
transaction token as a unique string.

Notice that the action mapping for userRegForm sets the parameter to load.
The action will use the parameter to load the form.

We already have this action defined. Thus, we need to modify the
UserRegistrationAction so that it can handle loading the form by calling
saveToken:

public class UserRegistrationAction extends
 LookupDispatchAction {

private static Log log =
 LogFactory.getLog(UserRegistrationAction.class);


public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
log.trace("UserRegistrationAction.execute");

if ("load".equals(mapping.getParameter())){
return load(mapping, form, request, response);
}else{
 return super.execute(mapping, form,
 request, response);
}
}

private ActionForward load(
   ActionMapping mapping,
   ActionForm form,
   HttpServletRequest request,
   HttpServletResponse response)
  throws Exception{
log.debug("In LOAD Method");
saveToken(request);
return mapping.findForward("success");
}


Let me know if this helps.

Rick Hightower
Developer

Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm

Struts/J2EE consulting --
http://www.arc-mind.com/consulting.htm#StrutsMentoring

-Original Message-
From: Dominique de Waleffe [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 13, 2004 9:59 AM
To: Struts Users Mailing List
Subject: Transaction tokens


I have a problem understanding how to use those

I have jsp pages using 
Ted's book says that "a hidden field is automatically added when the
form sees that a tokens are being used"
 but I fail to see how the forms sees that. In other wods, what do I
have to put as attribute to get the behaviour?
I do not see anything in rendered html form that looks like the
transaction token...

Then, in the action done on submit for those forms, I want to check for
double submit and react.
So I have this:
saveToken(request);
if ( ! isTokenValid(request)) {
errors.add(ActionErrors.GLOBAL_ERROR,
   new ActionError("error.multiple-submit"));
saveErrors(request,errors);
resetToken(request);
return mapping.findForward("multi-submit");
} // end of if ()

This always takes me into the error branch...  Is this a consequence of
the first problem (not having tokens sent)?

Thanks for any hint or example.

--
Dominique de Waleffe   Email: [EMAIL PROTECTED] [No HTML please]
Mission Critical, Drève Richelle 161 Bât N, B-1410 Waterloo, Belgium
Phone: +32 2 757 10 15  Fax: +32 2 759 27 60
ICQ: 289-306-495



-
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 PROTE

Transaction tokens

2004-01-13 Thread Dominique de Waleffe
I have a problem understanding how to use those

I have jsp pages using 
   Ted's book says that "a hidden field is automatically added when the 
form sees that a tokens are being used"
but I fail to see how the forms sees that. In other wods, what do I 
have to put as attribute to get the behaviour?
I do not see anything in rendered html form that looks like the 
transaction token...

Then, in the action done on submit for those forms, I want to check for 
double submit and react.
So I have this:
   saveToken(request);
   if ( ! isTokenValid(request)) {
   errors.add(ActionErrors.GLOBAL_ERROR,
  new ActionError("error.multiple-submit"));
   saveErrors(request,errors);
   resetToken(request);
   return mapping.findForward("multi-submit");
   } // end of if ()

This always takes me into the error branch...  Is this a consequence of 
the first problem (not having tokens sent)?

Thanks for any hint or example.

--
Dominique de Waleffe   Email: [EMAIL PROTECTED] [No HTML please]
Mission Critical, Drève Richelle 161 Bât N, B-1410 Waterloo, Belgium  
Phone: +32 2 757 10 15  Fax: +32 2 759 27 60
ICQ: 289-306-495



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


Re: ActionForm - redirect to custom JSP after validation failed

2004-01-13 Thread Mark Lowe
You could forward (not redirect) to a generic failure page if there are 
errors present. I confess i haven;t done this but it could be what you 
want, even forward to a global forward defined in struts config, so you 
can reuse you error page for other stuff.



On 13 Jan 2004, at 16:27, Christian Schlaefcke wrote:

Hi Folks,

I have a simple login.jsp that I want to validate. So I have a Class
"LoginForm" with a "validate" method, that fills up the ActionErrors 
with
the errors that might occur (missing username/password, wrong
username/password). Later the execute method of the corresponding 
Action
class "LoginAction" checks those ActionErrors. If not empty I try to
return a forward to "failure.jsp".

The problem I have is that before my LoginAction could execute my 
custom
forward the RequestProcessor of Struts tells in the logs, that 
validation
has failed and request will be forwarded to /login.jsp (which is of 
course
the input item of this action in struts-config.xml). When a validation
error occurs my LoginAction class is never called.

I searched the archive of this list already but couldn´t get through 
the
solutions I found there. I still don´t understand why this is happening
and what I can do to redirect to a custom failure.jsp.

Could someone please explain in newbie-style ;-) ?

Thanks & Regards!

Chris

-
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]


ActionForm - redirect to custom JSP after validation failed

2004-01-13 Thread Christian Schlaefcke
Hi Folks,

I have a simple login.jsp that I want to validate. So I have a Class
"LoginForm" with a "validate" method, that fills up the ActionErrors with
the errors that might occur (missing username/password, wrong
username/password). Later the execute method of the corresponding Action
class "LoginAction" checks those ActionErrors. If not empty I try to
return a forward to "failure.jsp".

The problem I have is that before my LoginAction could execute my custom
forward the RequestProcessor of Struts tells in the logs, that validation
has failed and request will be forwarded to /login.jsp (which is of course
the input item of this action in struts-config.xml). When a validation
error occurs my LoginAction class is never called.

I searched the archive of this list already but couldn´t get through the
solutions I found there. I still don´t understand why this is happening
and what I can do to redirect to a custom failure.jsp.

Could someone please explain in newbie-style ;-) ?

Thanks & Regards!

Chris

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



Re: mapping question

2004-01-13 Thread Mark Lowe
You can do either but i always use an action and forward to the jsp.

The only really objection not to routing your request through a mapping 
is that you expose your jsp's to the user. But this often isn;t a 
problem for some folks.

If you want to pre-populate your form then you can map the form to the 
referring action so you can mess with it before the user is forwarded 
to the form.

On 13 Jan 2004, at 15:58, Vanessa Monteiro wrote:

Hello everyone,

I'm having trouble understanding the mapping tags of
struts-config.xml.
I have one simple jsp form and one form and one action to take care of
it. In my /pages/form.jsp I have a 
My action-mapping is path=/action and I'm putting no input value. So to
get to my form I link to /pages/form.jsp or do I need and action to
point to the unsubmitted form?
Vanessa.

-
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]


mapping question

2004-01-13 Thread Vanessa Monteiro
Hello everyone,

I'm having trouble understanding the mapping tags of
struts-config.xml.

I have one simple jsp form and one form and one action to take care of
it. In my /pages/form.jsp I have a 

RE: handling form based authentication w/ remember-me cookie

2004-01-13 Thread Parmar, Dipakkumar
Hi Max,

I haven't tested it either.  I read it about this in "IBM WebSphere V5.0
Security handbook (page 64)".

Regards,
Dipak Parmar


-Original Message-
From: Max Cooper [mailto:[EMAIL PROTECTED]
Sent: Monday, January 12, 2004 10:42 PM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: Re: handling form based authentication w/ remember-me cookie


Dipak,

Are you certain that the filter will be invoked on the /j_security_check
request when container-based security is used? I have not tested this, but
it would not surprise me to find that some containers do not execute filters
on /j_security_check requests. I don't know if the Servlet Spec says
anything about this case.

Chris,

Another alternative to the original problem of security with "remember me"
functionality will be available soon. A patch has been submitted to my
SecurityFilter project (http://www.securityfilter.org/) to support "remember
me" functionality. The integration should be complete soon, and a beta
release will be made available once the integration is complete.
SecurityFilter works very much like container-managed security otherwise,
including the configuration format (except that you declare the constraints
in a separate config file rather than web.xml).

-Max

- Original Message -
From: "Parmar, Dipakkumar" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Monday, January 12, 2004 7:43 AM
Subject: RE: handling form based authentication w/ remember-me cookie


> Hi Chris,
>
> You can do this using Servlet Filter.  What you need to do is write
> postLoginFilter that maps to the j_security_check url.
>
> In doFilter method, you can write your post login code after
> j_security_check done is work.
>
> Something like:
> public void doFilter(.)
>
> // let the j_security_check to do it's work
> chain.doFilter(request, response)
>
> // do you post login stuff here
>
> Regards,
> Dipak Parmar
>
>
>
> -Original Message-
> From: Chris Ruegger [mailto:[EMAIL PROTECTED]
> Sent: Monday, January 12, 2004 9:53 AM
> To: Struts Users Mailing List
> Subject: handling form based authentication w/ remember-me cookie
>
>
> I am using Struts and building a logon page to do Form-based
authentication
> under Tomcat. I want to also have a checkbox for the user to check that
says
> "remember me" so that I can send them a cookie.  I'm not sure how to
> "intercept"
> the form values because I have to post to j_security_check. How can I get
> the
> check-box value, set up the cookie, and send them to j_security_check with
> struts?
>
> Thanks
>
>
> -
> 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: Using ArrayList instead of String[] properties

2004-01-13 Thread Mark Lowe
fair enough ..

i'm having a bad day with multiple, select menus and bean utils not 
dealing with life every well.

java.lang.IllegalArgumentException: argument type mismatch
bean utils seems to be complaining that the types in my form and those 
in the form bean are somehow different, i cant see where.

It was working, until i rearranged a few things. A few 
questions/suggestions in help me problem solve would be greatly 
appreciated if you have the time.

Cheers Mark

On 13 Jan 2004, at 15:50, Wendy Smoak wrote:

From: Mark Lowe [mailto:[EMAIL PROTECTED]
Using arrayList as a form property works fine with action
forms dyna or
otherwise. In fact IMO it makes like simpler. As i recall you were
trying to iterate through a map of forms not an arraylist.
The iterator goes through a Map, yes, but that Map isn't stored in the
form, it's just a list of things stored in the session that the user
needs to pick from.
I do not need to iterate over the ArrayList stored in the
DynaValidatorForm, I just wanted to store the user's choices there and
manipulate them in the Action code.  And I don't want them positional.
If I show him six choices and he picks the first and fourth, I want an
ArrayList with two items.
When I try to use ArrayList with multiple checkboxes, BeanUtils
complains that it can't do it:
org.apache.commons.beanutils.ConversionException: Cannot assign value
of type 'java.lang.String' to property 'accounts' of type
'java.util.ArrayList'
I would love to be able to use ArrayList in the DynaValidatorForm,
*without* indexing the property, which I don't need.  But I don't know
how to do the Struts tags so that BeanUtils is happy.  Which is fine,
really... I can deal with String[] with two extra lines of code.
--
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management
-
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: Using ArrayList instead of String[] properties

2004-01-13 Thread Wendy Smoak
> From: Mark Lowe [mailto:[EMAIL PROTECTED] 
> Using arrayList as a form property works fine with action 
> forms dyna or 
> otherwise. In fact IMO it makes like simpler. As i recall you were 
> trying to iterate through a map of forms not an arraylist.

The iterator goes through a Map, yes, but that Map isn't stored in the
form, it's just a list of things stored in the session that the user
needs to pick from.

I do not need to iterate over the ArrayList stored in the
DynaValidatorForm, I just wanted to store the user's choices there and
manipulate them in the Action code.  And I don't want them positional.
If I show him six choices and he picks the first and fourth, I want an
ArrayList with two items.

When I try to use ArrayList with multiple checkboxes, BeanUtils
complains that it can't do it:

org.apache.commons.beanutils.ConversionException: Cannot assign value
of type 'java.lang.String' to property 'accounts' of type
'java.util.ArrayList'

I would love to be able to use ArrayList in the DynaValidatorForm,
*without* indexing the property, which I don't need.  But I don't know
how to do the Struts tags so that BeanUtils is happy.  Which is fine,
really... I can deal with String[] with two extra lines of code.

-- 
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management 


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



Re: beginng with struts

2004-01-13 Thread Larry Meadors
Gabriel, look at these examples:

http://reumann.net

>>> [EMAIL PROTECTED] 01/13/04 8:23 AM >>>
hi
i'm starting to program with java struts

>snip<

somebody have a struts tutorial than help me to learn
about java struts?


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



beginng with struts

2004-01-13 Thread gabriel eduardo oliveros valencia
hi
i'm starting to program with java struts
i'm following a struts tutorial than i downloaded
from the web
i'm doing a example "hello world" and it don't work
the error than i get is the follow:
type Exception report

message

description The server encountered an internal error () that prevented it 
from fulfilling this request.

exception

org.apache.jasper.JasperException: No se puedee cargar la clase TagExtraInfo 
llamada: org.apache.struts.taglib.bean.CookieTei
   
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)
   
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:404)
   
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:319)
   
org.apache.jasper.compiler.TagLibraryInfoImpl.createTagInfo(TagLibraryInfoImpl.java:453)
   
org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:290)
   
org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:204)
   org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:458)
   org.apache.jasper.compiler.Parser.parseDirective(Parser.java:523)
   org.apache.jasper.compiler.Parser.parseElements(Parser.java:1577)
   org.apache.jasper.compiler.Parser.parse(Parser.java:171)
   
org.apache.jasper.compiler.ParserController.parse(ParserController.java:247)
   
org.apache.jasper.compiler.ParserController.parse(ParserController.java:149)
   
org.apache.jasper.compiler.ParserController.parse(ParserController.java:135)
   org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:237)
   org.apache.jasper.compiler.Compiler.compile(Compiler.java:456)
   org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
   
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:552)
   
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
   org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

root cause

java.lang.ClassNotFoundException: org.apache.struts.taglib.bean.CookieTei
   
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1366)
   
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1213)
   
org.apache.jasper.compiler.TagLibraryInfoImpl.createTagInfo(TagLibraryInfoImpl.java:450)
   
org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:290)
   
org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:204)
   org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:458)
   org.apache.jasper.compiler.Parser.parseDirective(Parser.java:523)
   org.apache.jasper.compiler.Parser.parseElements(Parser.java:1577)
   org.apache.jasper.compiler.Parser.parse(Parser.java:171)
   
org.apache.jasper.compiler.ParserController.parse(ParserController.java:247)
   
org.apache.jasper.compiler.ParserController.parse(ParserController.java:149)
   
org.apache.jasper.compiler.ParserController.parse(ParserController.java:135)
   org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:237)
   org.apache.jasper.compiler.Compiler.compile(Compiler.java:456)
   org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
   
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:552)
   
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
   org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:856)



somebody have a struts tutorial than help me to learn
about java struts?
i have jakarta-tomcat-5.0.16 and j2sdk1.4.1_06

thx for your colaborations

Gabriel Oliveros

_
Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail

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


Struts Tiles Double Post Issue

2004-01-13 Thread Smith Justin M
I am running into a problem with Struts Tiles.  My action class is being executed 
twice when I submit a page.

I have a simple page like this. 

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>




It executes the action that I define in my struts config.  


http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd";>




   




 






  


   

   











I am seeing the second execution happen when the   
line gets called in the layout.jsp file. 

<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

























 



























 

Any ideas why this is happening?

Is this normal?

Here is my tiles def xml file...


http://jakarta.apache.org/struts/dtds/tiles-config.dtd";>
  






   
  





   



   


Thanks...

Justin



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



RE: Modules with Tiles Problem

2004-01-13 Thread C.Aussems
Hi Patrick,

I'm interested in this thread because it seems we have (had?) similar
problems regarding  in modules with "global" tiles;
But your last question remained unanswered??

> Thanks David, The multiconfig eliminates the error message.
> Another question is, the  is screwed up.
> In traditional webpages, we've got, Header, Navbar, Body, maybe Footer.
> The s on the Navbar adds the context in their href locations.
> EG, original link in root context: 
> now, the link after module switching: 

Did you continue this thread somewhere else?
Anyhow I start a new thread now "How to use html:link using modules and
tiles"

Greetings,
Corné

struts-user Digest of: thread.89126


RE : Seven Lessons from the Trenches: 4. Protect JSPs behind WEB-INF
89112 by: Laurent MARQUEZ
89119 by: Laurent MARQUEZ
89126 by: Laurent MARQUEZ
89149 by: Laurent MARQUEZ

Administrivia:


--- Administrative commands for the struts-user list ---

I can handle administrative requests automatically. Please
do not send them to the list address! Instead, send
your message to the correct command address:

To subscribe to the list, send a message to:
   <[EMAIL PROTECTED]>

To remove your address from the list, send a message to:
   <[EMAIL PROTECTED]>

Send mail to the following for info and FAQ for this list:
   <[EMAIL PROTECTED]>
   <[EMAIL PROTECTED]>

Similar addresses exist for the digest list:
   <[EMAIL PROTECTED]>
   <[EMAIL PROTECTED]>

To get messages 123 through 145 (a maximum of 100 per request), mail:
   <[EMAIL PROTECTED]>

To get an index with subject and author for messages 123-456 , mail:
   <[EMAIL PROTECTED]>

They are always returned as sets of 100, max 2000 per request,
so you'll actually get 100-499.

To receive all messages with the same subject as message 12345,
send an empty message to:
   <[EMAIL PROTECTED]>

The messages do not really need to be empty, but I will ignore
their content. Only the ADDRESS you send to is important.

You can start a subscription for an alternate address,
for example "[EMAIL PROTECTED]", just add a hyphen and your
address (with '=' instead of '@') after the command word:
<[EMAIL PROTECTED]>

To stop subscription for this address, mail:
<[EMAIL PROTECTED]>

In both cases, I'll send a confirmation message to that address. When
you receive it, simply reply to it to complete your subscription.

If despite following these instructions, you do not get the
desired results, please contact my owner at
[EMAIL PROTECTED] Please be patient, my owner is a
lot slower than I am ;-)

--- Enclosed is a copy of the request I received.

Return-Path: <[EMAIL PROTECTED]>
Received: (qmail 44317 invoked from network); 13 Jan 2004 14:42:35 -
Received: from unknown (HELO smtpzilla1.xs4all.nl) (194.109.127.137)
  by daedalus.apache.org with SMTP; 13 Jan 2004 14:42:35 -
Received: from PTWPC019 (213-84-177-228.adsl.xs4all.nl [213.84.177.228])
by smtpzilla1.xs4all.nl (8.12.10/8.12.10) with SMTP id i0DEgaDi034481
for <[EMAIL PROTECTED]>; Tue, 13 Jan 2004 15:42:36 +0100 (CET)
Message-ID: <[EMAIL PROTECTED]>
From: "C.Aussems" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: 
Date: Tue, 13 Jan 2004 15:42:25 +0100
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="=_NextPart_000_0097_01C3D9EB.D7C2B6B0"
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N

This is a multi-part message in MIME format.

--=_NextPart_000_0097_01C3D9EB.D7C2B6B0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


--=_NextPart_000_0097_01C3D9EB.D7C2B6B0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable








 

--=_NextPart_000_0097_01C3D9EB.D7C2B6B0--


--

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

How to use html:link using modules and tiles

2004-01-13 Thread C.Aussems
I started using modules in my struts application, but have difficulties with
links defined in a default tile.

In my default app tiles-defs.xml I have defined a base layout which is being
extended in my module tiles-defs.xml.

The base layout puts a header, menu , body & footer

 
 
 


The body put is defined in module tile def

 


My menu has a link to the catalog module 

To switch between module contexts I have to use a SwitchAction,
which I like to define as least as possible, so in default app's
struts-config.xml


 

 
 

In the default applications pages all goes well, but in any module page I
get the folowing error
[ServletException in:/common/pages/menu.jsp] Cannot create rewrite URL:
java.net.MalformedURLException: Cannot retrieve ActionForward named
/catalog'

I tried te resolve this using different Html:link attributes and so on,
but it seems I have to define all menu links as global-forwards in all
modules ??? with contextRelative="true"
and map those to the the switches in default app's struts-config.xml or even
worse define them also in all modules ??
I can't believe this because then somehow all the modules are coupled and we
dont't want that, so i'm missing something, but what ?

Corné

(prev posted on jguru)


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



Re: Using ArrayList instead of String[] properties

2004-01-13 Thread Mark Lowe
Using arrayList as a form property works fine with action forms dyna or 
otherwise. In fact IMO it makes like simpler. As i recall you were 
trying to iterate through a map of forms not an arraylist.

On 13 Jan 2004, at 14:28, Wendy Smoak wrote:

From: Robert Taylor [mailto:[EMAIL PROTECTED]
Unless I've missed something, I don't see the need to using indexed
properties here if the selected value is single String and
order doesn't matter.
After much consideration, neither do I!  I thought ArrayList would be
easier to deal with, but it turns out that String[] is the right type 
to
use in the form bean [which has a Map because it's a 
DynaValidatorForm].
My entire purpose in switching to ArrayList was to avoid the inevitable
out of bounds exceptions in the Action code.  But that's easily done by
(something like) Arrays.asList() at the top, and then myList.toArray()
at the end.

Another Struts learning experience.  Thanks for the help!

--
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management
-
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: Pagination Support

2004-01-13 Thread C.Aussems
The Pager Tag Library is the easy and flexible way to implement paging of
large data sets in JavaServer Pages (JSP). It can emulate all currently
known paging styles with minimal effort. It also includes re-usable index
styles that emulate the search result navigators of popular web sites such
as GoogleSM, AltaVista® and Yahoo!. The Pager Tag Library does most of the
work for you by dynamically organizing your data set into pages and
generating a browsable index with virtually any look desired.

http://jsptags.com/tags/navigation/pager/index.jsp

- Original Message - 
From: "Brice Ruth" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, January 13, 2004 3:54 PM
Subject: Re: Pagination Support


> You might want to check out iBATiS, specifically the
> "executeQueryForPaginatedList" methods ... quite useful!!
>
> http://www.ibatis.com/
>
> Enjoy!
>
> Viral_Thakkar wrote:
>
> > Hi all,
> >
> >
> >
> > Do struts have any support for *_pagination_* purpose?
> >
> >
> >
> > By pagination, I mean, displaying the data retrieved from database in
> > JSP page in fixed slots...
> >
> >
> >
> > Thanks & Regards,
> >
> > Viral
> >
> >
> >
> >-
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
> -- 
> Brice D. Ruth
> Sr. IT Analyst
> Fiskars Brands, Inc.
>
>
> -
> 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: Pagination Support

2004-01-13 Thread Brice Ruth
You might want to check out iBATiS, specifically the 
"executeQueryForPaginatedList" methods ... quite useful!!

http://www.ibatis.com/

Enjoy!

Viral_Thakkar wrote:

Hi all,

 

Do struts have any support for *_pagination_* purpose?

 

By pagination, I mean, displaying the data retrieved from database in 
JSP page in fixed slots...

 

Thanks & Regards,

Viral



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Using ArrayList instead of String[] properties

2004-01-13 Thread Wendy Smoak
> From: Robert Taylor [mailto:[EMAIL PROTECTED] 
> Unless I've missed something, I don't see the need to using indexed
> properties here if the selected value is single String and 
> order doesn't matter.

After much consideration, neither do I!  I thought ArrayList would be
easier to deal with, but it turns out that String[] is the right type to
use in the form bean [which has a Map because it's a DynaValidatorForm].
My entire purpose in switching to ArrayList was to avoid the inevitable
out of bounds exceptions in the Action code.  But that's easily done by
(something like) Arrays.asList() at the top, and then myList.toArray()
at the end.

Another Struts learning experience.  Thanks for the help!

-- 
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management 

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



Bothersome BeanUtils.populate exception

2004-01-13 Thread Mark Lowe
beanUtils keeps getting its knickers in a twist when i submit a form  
with 2 select menus with multiple values. I've had this working before  
with the same version of struts and commons. Its not the action as the  
exception is thrown before i get that far, when i remove the menus the  
form submits fine.

I have form properties of type arrayList. I;d expect this exception if  
i were to be using unsupported types but I've been setting the values  
with  String and the form properties are also of type string.

I have trouble believing that bean utils has an issue with converting  
Object to String when the values are copied.

The exception is a typical beanutils chocolate fire guard exception. If  
i weren't using strings i'd understand but i am.

Any insights welcomed.

java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at  
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav 
a:39)
at  
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor 
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at  
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUti 
ls.java:1789)
at  
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUti 
ls.java:1684)
at  
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.jav 
a:1713)
at  
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
at  
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)

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


RE: Using ArrayList instead of String[] properties

2004-01-13 Thread Robert Taylor
Wendy,

If you simply want to present a list of options to the user represented as
check boxes
and collect the selected options, and the selected options are just single
string values,
then you can do the following:

Define accounts property as an java.lang.String[] and initialize it to {}.



Retrieve you options and store them in an ArrayList named "accountOptions"
and render the options like so:





This should generate HTML like:





The servlet container will collect these values and place them in a single
String array under
the "accounts" name.

Struts will reset your form and them populate the accounts property of your
form with the String array.

Unless I've missed something, I don't see the need to using indexed
properties here if the selected value is single String and order doesn't
matter.


robert


> -Original Message-
> From: shankarr [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, January 13, 2004 7:07 AM
> To: Struts Users Mailing List
> Subject: RE: Using ArrayList instead of String[] properties
>
>
> Hi!
> I was myself trying to work on a similar issue.
>
> My problem is as follows:
> i query db.
> Then store data in Araylist.
> How to pass this to jsp page?
>
> Any sample code great appreciation.
> Please urgent.
>
> Sha
>
> At 02:27 PM 1/12/2004 -0700, you wrote:
> > > From: Wendy Smoak
> > > Apparently you don't have to use
> > > logic-el:iterate with html-el:checkbox & indexed="true".  This works:
> > >  > > var="account" >
> > >  
> >
> >I lied, that doesn't work at all.  It produces HTML like this:
> >
> >>name="org.apache.struts.taglib.html.BEAN[0].accounts"
> >value="on">10_U_FADA0001
> >
> >I read that indexed properties only work with logic:iterate, so I'm
> >trying to change over from logic:forEach.  Can someone help me sort this
> >out?
> >
> >This works to generate HTML, but BeanUtils can't populate the ArrayList
> >that is the 'accounts' property of accountForm because the bracketed []
> >indexes are missing.
> >
> > >collection="${accountMap[accountForm.map.calendarYear]}"
> >   id="acct"
> >   indexId="ctr">
> >  
> > 
> >  
> >  ...
> >
> >However, if I add indexed="true" like so:
> >
> > >collection="${accountMap[accountForm.map.calendarYear]}" id="acct"
> >indexId="ctr">
> >  
> > 
> >  
> >
> >It renders this HTML:
> >   >name="org.apache.struts.taglib.html.BEAN[0].accounts"
> >value="on">10_U_FADA0001
> >
> >??! This is my first attempt at indexed properties, which apparently I
> >need in order to use an ArrayList.  (The items in the ArrayList are just
> >Strings, not complex objects.  This isn't nested properties, it's just a
> >bunch of checkboxes.  I'm trying to use ArrayList instead of String[] to
> >avoid out of bounds errors.  String[] was working *fine* last week,
> >until I got the bright idea to use ArrayList.)
> >
> >I'm getting the feeling that the things in the ArrayList property of the
> >form have to be complex objects and not just Strings.
> >
> >--
> >Wendy Smoak
> >Application Systems Analyst, Sr.
> >ASU IA Information Resources Management
> >
> >-
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
>
> "To achieve all that is possible, one must attempt the impossible"
>
>
>
> -
> 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]



Implementing the equals method on an ActionForm

2004-01-13 Thread Potter, Ivor
I have encountered a problem where the equals method was implemented on an
ActionForm to return true under very loose conditions (ie two similar
objects would be regarded as equal).  This however broke our JSPs which were
then unable to fetch properties from the form bean.  Removal of the equals
method fixed the code again.
 
Does anyone know why this occurred - I have examined the source code for the
html tags and cannot see any point at which it would rely on the equals
functionality.
 
Cheers
 
Ivor


===
This message contains information that may be privileged or confidential and is the 
property of the Cap Gemini Ernst & Young Group. It is intended only for the person to 
whom it is addressed. If you are not the intended recipient, you are not authorised to 
read, print, retain, copy, disseminate, distribute, or use this message or any part 
thereof. If you receive this message in error, please notify the sender immediately 
and delete all copies of this message.
===



Re: handling form based authentication w/ remember-me cookie

2004-01-13 Thread Martin Gainty
Add 1 Nota Bene:
"objects in request scope are lost on a redirect, but remain in scope after
a forward..."
-Martin

- Original Message -
From: "Matt Raible" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, January 13, 2004 7:05 AM
Subject: Re: handling form based authentication w/ remember-me cookie


>
> On Jan 13, 2004, at 12:42 AM, Craig R. McClanahan wrote:
> >
> > Filters are *not* required to be invoked on j_security_check
> > invocations.  In
> > fact, Tomcat won't even enable the "j_security_check" url unless an
> > unauthenticated user accesses a protected resource.  Basically, I
> > believe there
> > is no guaranteed-to-be-portable way to implement "remember me"
> > functionality on
> > the server using container managed security.
> >
> > Craig
>
> The Filter I use is mapped to the location of the .
> The solution I use does work on both Tomcat 4/5 and Resin, which is
> portable enough for me!  I did have to add
> FORWARD for Tomcat 5 and Resin, where the
> login page is displayed using a forward instead of a redirect.
>
> Matt
>
>
> -
> 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: Using ArrayList instead of String[] properties

2004-01-13 Thread Mark Lowe
what does you form bean look like (dyna or otherwise)?



On 13 Jan 2004, at 12:07, shankarr wrote:

Hi!
I was myself trying to work on a similar issue.
My problem is as follows:
i query db.
Then store data in Araylist.
How to pass this to jsp page?
Any sample code great appreciation.
Please urgent.
Sha

At 02:27 PM 1/12/2004 -0700, you wrote:
> From: Wendy Smoak
> Apparently you don't have to use
> logic-el:iterate with html-el:checkbox & indexed="true".  This 
works:
> 
> var="account" >
>  

I lied, that doesn't work at all.  It produces HTML like this:

  10_U_FADA0001
I read that indexed properties only work with logic:iterate, so I'm
trying to change over from logic:forEach.  Can someone help me sort 
this
out?

This works to generate HTML, but BeanUtils can't populate the 
ArrayList
that is the 'accounts' property of accountForm because the bracketed 
[]
indexes are missing.


 

 
 ...
However, if I add indexed="true" like so:


 

 
It renders this HTML:
 10_U_FADA0001
??! This is my first attempt at indexed properties, which apparently I
need in order to use an ArrayList.  (The items in the ArrayList are 
just
Strings, not complex objects.  This isn't nested properties, it's 
just a
bunch of checkboxes.  I'm trying to use ArrayList instead of String[] 
to
avoid out of bounds errors.  String[] was working *fine* last week,
until I got the bright idea to use ArrayList.)

I'm getting the feeling that the things in the ArrayList property of 
the
form have to be complex objects and not just Strings.

--
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
"To achieve all that is possible, one must attempt the impossible"



-
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: Linking CSS

2004-01-13 Thread Martin Gainty
If this was Websphere I would say that it is
install root>/config/cells//virtualhosts.xml
Take a look at Jason McGee's article on IBM on how to configure virtual
hosts
http://www-106.ibm.com/developerworks/websphere/library/techarticles/0301_mc
gee/mcgee.html
Regards,
Martin Gainty
- Original Message -
From: "vasudevrao gupta" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Tuesday, January 13, 2004 12:26 AM
Subject: RE: Linking CSS


>
>
> Servlet Request Processor Exception: Virtual Host/WebGroup Not Found :
> The web group /theme/Master.css has not been defined
>
> Is the error which it displays
>
> -Original Message-
> From: Mike Deegan [mailto:[EMAIL PROTECTED]
> Sent: 13 January 2004 10:31
> To: Struts Users Mailing List
> Subject: Re: Linking CSS
>
>
>
> 
>
> works for me ...
>
> what is the error you are getting?
>
> may require use of the  tag ?
>
>
> - Original Message -
> From: "vasudevrao gupta" <[EMAIL PROTECTED]>
> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> Sent: Monday, January 12, 2004 9:48 PM
> Subject: Linking CSS
>
>
> >
> >
> >
> > Dear All,
> >
> > I am usign WebSphere Application Development Studio for development of
> > our application in struts.
> > When I am linking .css files to a JSP using normal HTML tag, its not
> > getting identified,..Do we need to use a different syntax for linking
> > .css files for JSP in struts???
> > Eg:
> >  > type="text/css">
> > Regards
> > vasudevRaoGupta
> >
> >
> > Confidentiality Notice
> >
> > The information contained in this electronic message and any
> attachments
> to this message are intended
> > for the exclusive use of the addressee(s) and may contain confidential
> or
> privileged information. If
> > you are not the intended recipient, please notify the sender at Wipro
> or
> [EMAIL PROTECTED] immediately
> > and destroy all copies of this message and any attachments.
> >
> > -
> > 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]
>
>
> Confidentiality Notice
>
> The information contained in this electronic message and any attachments
to this message are intended
> for the exclusive use of the addressee(s) and may contain confidential or
privileged information. If
> you are not the intended recipient, please notify the sender at Wipro or
[EMAIL PROTECTED] immediately
> and destroy all copies of this message and any attachments.
>
> -
> 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: Templates And Modules - Please HELP !!

2004-01-13 Thread Patrick Cheng
Hi,
A few other folks and I had a discussion on this topic in this list
archive, search for it.
I just hope that I have not misunderstand you.
Topic of the message thread is "Modules with Tiles Problem". See if it
helps.
(if you really can't find these messages, I can PM you)
Rgds,
Patrick.

-Original Message-
From: Renato Romano [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 13, 2004 6:37 PM
To: 'Struts Users Mailing List'
Subject: Templates And Modules - Please HELP !!


I already used the struts  tags successfully, but I'm having
trouble now inside a "moduled" application. The problem is that the
template tags seems to insert the module prefix before the path of the
jsp template file, which I would not, also because I thought the jsp
pages could/should not necessarily fit into a module, but could be
shared between modules. Every part of the struts framework seem to allow
this (note for example the contextRelative attribute in struts-config),
but the template tag seem not to do so. One solution is to put my jsp
inside subdirectories with the same names as modules, but as I said I'd
like to share some jsp between modules... Should I pass to tiles ??? I
don't need a complicated templating library so i'd prefer to simply use
template taglibs, but if tiles helps ... Any help is VERY appreciated.
Thanks 

Renato


Renato Romano
Sistemi e Telematica S.p.A.
Calata Grazie - Vial Al Molo Giano
16127 - GENOVA

e-mail: [EMAIL PROTECTED]
Tel.:   010 2712603
_



-
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: handling form based authentication w/ remember-me cookie

2004-01-13 Thread Matt Raible
On Jan 13, 2004, at 12:42 AM, Craig R. McClanahan wrote:
Filters are *not* required to be invoked on j_security_check 
invocations.  In
fact, Tomcat won't even enable the "j_security_check" url unless an
unauthenticated user accesses a protected resource.  Basically, I 
believe there
is no guaranteed-to-be-portable way to implement "remember me" 
functionality on
the server using container managed security.

Craig
The Filter I use is mapped to the location of the .  
The solution I use does work on both Tomcat 4/5 and Resin, which is 
portable enough for me!  I did have to add 
FORWARD for Tomcat 5 and Resin, where the 
login page is displayed using a forward instead of a redirect.

Matt

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


RE: Using ArrayList instead of String[] properties

2004-01-13 Thread shankarr
Hi!
I was myself trying to work on a similar issue.
My problem is as follows:
i query db.
Then store data in Araylist.
How to pass this to jsp page?
Any sample code great appreciation.
Please urgent.
Sha

At 02:27 PM 1/12/2004 -0700, you wrote:
> From: Wendy Smoak
> Apparently you don't have to use
> logic-el:iterate with html-el:checkbox & indexed="true".  This works:
>  var="account" >
>  
I lied, that doesn't work at all.  It produces HTML like this:

  10_U_FADA0001
I read that indexed properties only work with logic:iterate, so I'm
trying to change over from logic:forEach.  Can someone help me sort this
out?
This works to generate HTML, but BeanUtils can't populate the ArrayList
that is the 'accounts' property of accountForm because the bracketed []
indexes are missing.

 

 
 ...
However, if I add indexed="true" like so:


 

 
It renders this HTML:
 10_U_FADA0001
??! This is my first attempt at indexed properties, which apparently I
need in order to use an ArrayList.  (The items in the ArrayList are just
Strings, not complex objects.  This isn't nested properties, it's just a
bunch of checkboxes.  I'm trying to use ArrayList instead of String[] to
avoid out of bounds errors.  String[] was working *fine* last week,
until I got the bright idea to use ArrayList.)
I'm getting the feeling that the things in the ArrayList property of the
form have to be complex objects and not just Strings.
--
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
"To achieve all that is possible, one must attempt the impossible"



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


Re: BeanUtils.populate form

2004-01-13 Thread Mark Lowe
Don't worry I was being a dick..

On 13 Jan 2004, at 10:05, Mark Lowe wrote:

I'm getting an exception thrown by bean utils when i submit a form, i  
think this is related to setting a form property of type hashmap.

The values are set correctly in the jsp, and i'm not validating yet.  
Are there any issues related to using maps as form properties? I've  
scoped the form to session as the size of the map is unknown until  
submission.

here's what i consider a useful part of my stacktrace, if you;ve had  
this problem before then any insights appeciated.

java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at  
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja 
va:39)
at  
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso 
rImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at  
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUt 
ils.java:1789)
at  
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUt 
ils.java:1684)
at  
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.ja 
va:1713)
at  
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java: 
1019)
at  
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)

-
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: REQUEST_PROCESSOR - couldn't deserialize

2004-01-13 Thread Leticia Golubov
I've had a similar problem before when the offending class did not implement
java.io.Serializable...

regards

Leticia

-Original Message-
From: Gopalakrishnan, Jayesh [mailto:[EMAIL PROTECTED]
Sent: 12 January 2004 18:54
To: Struts Users Mailing List
Subject: REQUEST_PROCESSOR - couldn't deserialize


Has anybody encountered this exception...?

   
<[ServletContext(id=158851062,name=stap-portal,context-path=/stap-portal)]
could not deserialize the context attribute
"org.apache.struts.action.REQUEST_PROCESSOR"
java.io.NotSerializableException:org.apache.struts.tiles.TilesRequestProcess
or
   at
java.io.ObjectOutputStream.writeObject0(Ljava.lang.Object;Z)V(Unknown
Source)
   at
java.io.ObjectOutputStream.writeObject(Ljava.lang.Object;)V(Unknown Source)
   at
weblogic.servlet.internal.AttributeWrapper.getObject(Z)Ljava.lang.Object;(At
tributeWrapper.java:95)
   at
weblogic.servlet.internal.AttributeWrapper.getObject()Ljava.lang.Object;(Att
ributeWrapper.java:67)
   at
weblogic.servlet.internal.WebAppServletContext.getAttribute(Ljava.lang.Strin
g;)Ljava.lang.Object;(WebAppServletContext.java:637)
   at
org.apache.struts.action.ActionServlet.getRequestProcessor(Lorg.apache.strut
s.config.ModuleConfig;)Lorg.apache.struts.action.RequestProcessor;(ActionSer
.


This exception is intermittent, unpredictable so far.

thx in advance
-jayash

-
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]



Templates And Modules - Please HELP !!

2004-01-13 Thread Renato Romano
I already used the struts  tags successfully, but I'm having
trouble now inside a "moduled" application. The problem is that the
template tags seems to insert the module prefix before the path of the
jsp template file, which I would not, also because I thought the jsp
pages could/should not necessarily fit into a module, but could be
shared between modules. Every part of the struts framework seem to allow
this (note for example the contextRelative attribute in struts-config),
but the template tag seem not to do so. One solution is to put my jsp
inside subdirectories with the same names as modules, but as I said I'd
like to share some jsp between modules... Should I pass to tiles ??? I
don't need a complicated templating library so i'd prefer to simply use
template taglibs, but if tiles helps ...
Any help is VERY appreciated.
Thanks 

Renato


Renato Romano
Sistemi e Telematica S.p.A.
Calata Grazie - Vial Al Molo Giano
16127 - GENOVA

e-mail: [EMAIL PROTECTED]
Tel.:   010 2712603
_



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



BeanUtils.populate form

2004-01-13 Thread Mark Lowe
I'm getting an exception thrown by bean utils when i submit a form, i  
think this is related to setting a form property of type hashmap.

The values are set correctly in the jsp, and i'm not validating yet.  
Are there any issues related to using maps as form properties? I've  
scoped the form to session as the size of the map is unknown until  
submission.

here's what i consider a useful part of my stacktrace, if you;ve had  
this problem before then any insights appeciated.

java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at  
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav 
a:39)
at  
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor 
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at  
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUti 
ls.java:1789)
at  
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUti 
ls.java:1684)
at  
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.jav 
a:1713)
at  
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
at  
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)

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


ActionForm LifeCycle (Maybe a bug in Struts)

2004-01-13 Thread Rodney Paul
Hi All,
 
I was wondering if anyone knew what the lifecycle of an ActionForm is?
The reason I ask is in regards to the display of variables with a .
 
I have noticed that the values displayed within a  are values after a 
reset() method has been called,
and not after a validate method is called. Can anyone tell me the reason for this, as 
I seem to think this is a bug
within the Struts framework.
 
 
An example follows as to what I am talking about (based upon the following ActionForm):
 
 
// Example ActionForm
public class MyActionForm extends ActionForm {
private String maximumDocuments = "3";
...// More variables


public MyActionForm() {
super();
System.out.println("Constructor called");
}



public void setMaximumDocuments(String maximumDocuments) {
this.maximumDocuments = maximumDocuments;
}

public String getMaximumDocuments() {
return maximumDocuments;
}
...// More get/set methods


public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest 
httpServletRequest) {
ActionErrors errors = new ActionErrors();

System.out.println("validate called");
System.out.println("before processing maximumDocuments: " + maximumDocuments);
 
if(maximumDocuments == null) {
maximumDocuments = "50";// The supposed default value (if no value 
entered)
}

System.out.println("after processing maximumDocuments: " + maximumDocuments);
...// Say an error has been returned
return errors;
}

public void reset(ActionMapping mapping, HttpServletRequest request) {
System.out.println("reset called");
System.out.println("before processing maximumDocuments: " + 
this.maximumDocuments);
 
this.maximumDocuments   = "50";

System.out.println("after processign maximumDocuments: " + 
this.maximumDocuments);
}
}

 
 
SCENARIOS:


 

LIFECYCLE 1: From a previous page to a form which uses this ActionForm
 
The following output gets displayed:
 
Constructor called
reset called
before processing maximumDocuments: 3
after processing maximumDocuments: 50
 
RESULT: Here the value displayed in the form is 50 for maximumDocuments   (Correct)

 
--
LIFECYCLE 2: If an error occurs within the ActionForm (and the value 1 has been 
entered for maximumDocuments)
 
The following output gets displayed:
 
Constructor called
reset called
before processing maximumDocuments: 3
after processing maximumDocuments: 50
validate called
before processing maximumDocuments: 1
after processing maximumDocuments: 1
 
RESULT: Here the value displayed in the form is 50 for maximumDocuments(Incorrect 
as it should be 1)
--
 
 
 
Can anyone please tell me why this is happening, and how to correct this problem.
 
Cheers
Rodneyt Paul
 


Re: Linking CSS

2004-01-13 Thread Christian Bollmeyer
Why not use JSTL and let the server determine the location?

"
type="text/css">

If the jsessionid string that may be automatically appended
by  bothers you, it's easy to write a small custom tag
exclusively for such purposes.

-- Chris.

- Original Message -
From: "vasudevrao gupta" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Tuesday, January 13, 2004 5:48 AM
Subject: Linking CSS


>
>
>
> Dear All,
>
> I am usign WebSphere Application Development Studio for development of
> our application in struts.
> When I am linking .css files to a JSP using normal HTML tag, its not
> getting identified,..Do we need to use a different syntax for linking
> .css files for JSP in struts???
> Eg:
>  type="text/css">
> Regards
> vasudevRaoGupta
>
>
> Confidentiality Notice
>
> The information contained in this electronic message and any attachments
to this message are intended
> for the exclusive use of the addressee(s) and may contain confidential or
privileged information. If
> you are not the intended recipient, please notify the sender at Wipro or
[EMAIL PROTECTED] immediately
> and destroy all copies of this message and any attachments.
>
> -
> 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: Using ArrayList instead of String[] properties

2004-01-13 Thread Mark Lowe


In the logic-el:iterate you defined the bean to scope with the id 
attribute, but then don't reference it in the form element



I'd consider not storing the formbeans in a map as you don't need to 
get the values out with a key. I provided an example of how to do this 
in this thread even making an arrayList of dynaactionforms will work.

cheers Mark

On 12 Jan 2004, at 21:27, Wendy Smoak wrote:

From: Wendy Smoak
Apparently you don't have to use
logic-el:iterate with html-el:checkbox & indexed="true".  This works:

 
I lied, that doesn't work at all.  It produces HTML like this:

  10_U_FADA0001
I read that indexed properties only work with logic:iterate, so I'm
trying to change over from logic:forEach.  Can someone help me sort 
this
out?

This works to generate HTML, but BeanUtils can't populate the ArrayList
that is the 'accounts' property of accountForm because the bracketed []
indexes are missing.

 

 
 ...
However, if I add indexed="true" like so:


 

 
It renders this HTML:
 10_U_FADA0001
??! This is my first attempt at indexed properties, which apparently I
need in order to use an ArrayList.  (The items in the ArrayList are 
just
Strings, not complex objects.  This isn't nested properties, it's just 
a
bunch of checkboxes.  I'm trying to use ArrayList instead of String[] 
to
avoid out of bounds errors.  String[] was working *fine* last week,
until I got the bright idea to use ArrayList.)

I'm getting the feeling that the things in the ArrayList property of 
the
form have to be complex objects and not just Strings.

--
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management
-
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: Mandatory use of form rather than request object

2004-01-13 Thread Shishir K. Singh
Aaah...but these are not related to form actions and are more like query
strings. I guess in this case, request.getParameter would still be  the
best bet, rather than trying to go for an overkill with the hidden id
field  etc etc ...just my thought. 
 
If you still don't want to request object, you may have a hidden form
with a hidden field. With onclick, you can call a java script function
to update the hidden field and then submit the form. Never tried this
though with links. 




-Original Message-
From: Patrick Cheng [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 13, 2004 3:33 AM
To: Struts Users Mailing List
Subject: RE: Mandatory use of form rather than request object

Hi ,
Can you elaborate a bit?  The situation in my mind is, a jsp page with a
list of records, but no form at all.
Like
Orange

Of course the a links are generate by struts. Then how couldthe form be
used in this case? 
I can think of using a hidden field in a form, and then on click, change
the hidden value to the id, and call the form submit.

Rgds,
Patrick.

-Original Message-
From: Richard Hightower [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 13, 2004 3:08 PM
To: Struts Users Mailing List
Subject: RE: Mandatory use of form rather than request object


forgive mebut could'nt your form have an id property?

then your action's execute method could get the id from the form.

Rick Hightower
Developer

Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm

Struts/J2EE consulting --
http://www.arc-mind.com/consulting.htm#StrutsMentoring

-Original Message-
From: Patrick Cheng [mailto:[EMAIL PROTECTED]
Sent: Monday, January 12, 2004 7:34 PM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: RE: Mandatory use of form rather than request object


Hi,
I understand that the request.getParameter should not be used when the
info is readily available in the 'form' object. But can we really take
it out? When I create a list of records in a table, with links to each
record details, I would be generating an  object with
parameters attached, resulting in sth like: . Then I need to use the
request.getParameter to get the id, then retrieve the record details
from db.  So my question is, is there a way to get around this, so I can
get rid of request.getParameter completely?

Rgds,
Patrick.



-Original Message-
From: Andrew Hill [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 13, 2004 10:09 AM
To: Struts Users Mailing List
Subject: RE: Mandatory use of form rather than request object


No. He would provide setters in the form for anything that needs to be
passed along in request scope. This has the dual advantages of type
safety and making the design more explicit to anyone reading the code.

-Original Message-
From: Brice Ruth [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 13 January 2004 02:25
To: Struts Users Mailing List
Subject: Re: Mandatory use of form rather than request object


This precludes you from storing data in the request scope, though - so
you're left with only storing things in the session scope, which I
wouldn't consider ideal.

Right?

Richard Hightower wrote:

>Create a superclass that overides the execute method and calls an 
>abstract execute method that does not pass the request object. The 
>subclasses overide the execute method without the request object being 
>passed.
>
>Also look into the ProcessAction, which is part of the scaffold.
>
>You can get the scaffold code by downloading the struts source.
>
>
>Rick Hightower
>Developer
>
>Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm
>
>Struts/J2EE consulting -- 
>http://www.arc-mind.com/consulting.htm#StrutsMentoring
>
>-Original Message-
>From: Abhishek Srivastava [mailto:[EMAIL PROTECTED]
>Sent: Monday, January 12, 2004 8:19 AM
>To: 'Struts Users Mailing List'
>Subject: Mandatory use of form rather than request object
>
>
>Hello All,
>
>I did some code reviews recently for my project being done on struts.
>
>I found that most people still do a request.getAttribute("NAME") kind 
>of code even when the name is a property of the form object and is 
>available
in
>the form object.
>
>My question is should the use of form be mandatory. If yes, how it can 
>be enforced. Is there quick way I can remove all the params/attributes 
>from
the
>request object once the corresponding values have been set in the form 
>object?
>
>Thanks in advance for your advise.
>
>Regards,
>Abhishek.
>
>-
>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]
>
>
>

--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.


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

RE: Mandatory use of form rather than request object

2004-01-13 Thread Patrick Cheng
Hi ,
Can you elaborate a bit?  The situation in my mind is, a jsp page with a
list of records, but no form at all.
Like
Orange

Of course the a links are generate by struts. Then how could the form be
used in this case? 
I can think of using a hidden field in a form, and then on click, change
the hidden value to the id, and call the form submit.

Rgds,
Patrick.

-Original Message-
From: Richard Hightower [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 13, 2004 3:08 PM
To: Struts Users Mailing List
Subject: RE: Mandatory use of form rather than request object


forgive mebut could'nt your form have an id property?

then your action's execute method could get the id from the form.

Rick Hightower
Developer

Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm

Struts/J2EE consulting --
http://www.arc-mind.com/consulting.htm#StrutsMentoring

-Original Message-
From: Patrick Cheng [mailto:[EMAIL PROTECTED]
Sent: Monday, January 12, 2004 7:34 PM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: RE: Mandatory use of form rather than request object


Hi,
I understand that the request.getParameter should not be used when the
info is readily available in the 'form' object. But can we really take
it out? When I create a list of records in a table, with links to each
record details, I would be generating an  object with
parameters attached, resulting in sth like: . Then I need to use the
request.getParameter to get the id, then retrieve the record details
from db.  So my question is, is there a way to get around this, so I can
get rid of request.getParameter completely?

Rgds,
Patrick.



-Original Message-
From: Andrew Hill [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 13, 2004 10:09 AM
To: Struts Users Mailing List
Subject: RE: Mandatory use of form rather than request object


No. He would provide setters in the form for anything that needs to be
passed along in request scope. This has the dual advantages of type
safety and making the design more explicit to anyone reading the code.

-Original Message-
From: Brice Ruth [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 13 January 2004 02:25
To: Struts Users Mailing List
Subject: Re: Mandatory use of form rather than request object


This precludes you from storing data in the request scope, though - so
you're left with only storing things in the session scope, which I
wouldn't consider ideal.

Right?

Richard Hightower wrote:

>Create a superclass that overides the execute method and calls an 
>abstract execute method that does not pass the request object. The 
>subclasses overide the execute method without the request object being 
>passed.
>
>Also look into the ProcessAction, which is part of the scaffold.
>
>You can get the scaffold code by downloading the struts source.
>
>
>Rick Hightower
>Developer
>
>Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm
>
>Struts/J2EE consulting -- 
>http://www.arc-mind.com/consulting.htm#StrutsMentoring
>
>-Original Message-
>From: Abhishek Srivastava [mailto:[EMAIL PROTECTED]
>Sent: Monday, January 12, 2004 8:19 AM
>To: 'Struts Users Mailing List'
>Subject: Mandatory use of form rather than request object
>
>
>Hello All,
>
>I did some code reviews recently for my project being done on struts.
>
>I found that most people still do a request.getAttribute("NAME") kind 
>of code even when the name is a property of the form object and is 
>available
in
>the form object.
>
>My question is should the use of form be mandatory. If yes, how it can 
>be enforced. Is there quick way I can remove all the params/attributes 
>from
the
>request object once the corresponding values have been set in the form 
>object?
>
>Thanks in advance for your advise.
>
>Regards,
>Abhishek.
>
>-
>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]
>
>
>

--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.


-
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]

-
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]


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

Cannot find message resources under key org.apache.struts.action.MESSAGE

2004-01-13 Thread Namasivayam, Sudhakar (Cognizant)
Title: Cannot find message resources under key org.apache.struts.action.MESSAGE









Hi ,

  I got this error after i restarted the system. I tried delpoying it again. I checked the struts config file also

Pls help me finding the error.


thanks,

sudhakar


org.apache.jasper.JasperException: Cannot find message resources under key org.apache.struts.action.MESSAGE

    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)

    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)

    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)

    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)

    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)

    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)

    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)

    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)

    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)

    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)

    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)

    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)

    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)

    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)

    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:601)

    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)

    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)

    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)

    at java.lang.Thread.run(Thread.java:536)

root cause 

javax.servlet.ServletException: Cannot find message resources under key org.apache.struts.action.MESSAGE

    at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533)

    at org.apache.jsp.logon_jsp._jspService(logon_jsp.java:89)

    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)

    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)

    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)

    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)

    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

    at org.apache.catalina.core.Standard

Re: handling form based authentication w/ remember-me cookie

2004-01-13 Thread Craig R. McClanahan
Quoting Matt Raible <[EMAIL PROTECTED]>:

> Remember Me functionality with j_security_check has worked fine for me. 
>   I just go to a LoginServlet from my loginForm, which sets cookies and 
> redirects to j_security_check.  Then I map a Filter to check for those 
> cookies and logs the user in appropriately.  More with code at:
> 
> http://www.mail-archive.com/[EMAIL PROTECTED]/msg86636.html
> 
> Complete code is available in my AppFuse application at:
> 
> http://raibledesigns.com/wiki/Wiki.jsp?page=AppFuse
> 
> HTH,
> 
> Matt
> 

Filters are *not* required to be invoked on j_security_check invocations.  In
fact, Tomcat won't even enable the "j_security_check" url unless an
unauthenticated user accesses a protected resource.  Basically, I believe there
is no guaranteed-to-be-portable way to implement "remember me" functionality on
the server using container managed security.

Craig



> On Jan 12, 2004, at 8:41 PM, Max Cooper wrote:
> 
> > Dipak,
> >
> > Are you certain that the filter will be invoked on the 
> > /j_security_check
> > request when container-based security is used? I have not tested this, 
> > but
> > it would not surprise me to find that some containers do not execute 
> > filters
> > on /j_security_check requests. I don't know if the Servlet Spec says
> > anything about this case.
> >
> > Chris,
> >
> > Another alternative to the original problem of security with "remember 
> > me"
> > functionality will be available soon. A patch has been submitted to my
> > SecurityFilter project (http://www.securityfilter.org/) to support 
> > "remember
> > me" functionality. The integration should be complete soon, and a beta
> > release will be made available once the integration is complete.
> > SecurityFilter works very much like container-managed security 
> > otherwise,
> > including the configuration format (except that you declare the 
> > constraints
> > in a separate config file rather than web.xml).
> >
> > -Max
> >
> > - Original Message -
> > From: "Parmar, Dipakkumar" <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > Sent: Monday, January 12, 2004 7:43 AM
> > Subject: RE: handling form based authentication w/ remember-me cookie
> >
> >
> >> Hi Chris,
> >>
> >> You can do this using Servlet Filter.  What you need to do is write
> >> postLoginFilter that maps to the j_security_check url.
> >>
> >> In doFilter method, you can write your post login code after
> >> j_security_check done is work.
> >>
> >> Something like:
> >> public void doFilter(.)
> >>
> >> // let the j_security_check to do it's work
> >> chain.doFilter(request, response)
> >>
> >> // do you post login stuff here
> >>
> >> Regards,
> >> Dipak Parmar
> >>
> >>
> >>
> >> -Original Message-
> >> From: Chris Ruegger [mailto:[EMAIL PROTECTED]
> >> Sent: Monday, January 12, 2004 9:53 AM
> >> To: Struts Users Mailing List
> >> Subject: handling form based authentication w/ remember-me cookie
> >>
> >>
> >> I am using Struts and building a logon page to do Form-based
> > authentication
> >> under Tomcat. I want to also have a checkbox for the user to check 
> >> that
> > says
> >> "remember me" so that I can send them a cookie.  I'm not sure how to
> >> "intercept"
> >> the form values because I have to post to j_security_check. How can I 
> >> get
> >> the
> >> check-box value, set up the cookie, and send them to j_security_check 
> >> with
> >> struts?
> >>
> >> Thanks
> >>
> >>
> >> -
> >> 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]
> 
> 
> -
> 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: Mandatory use of form rather than request object

2004-01-13 Thread Richard Hightower
sometimes code reviews and/or pair programming work as well
although, electric shock is more fun.

Rick Hightower
Developer

Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm

Struts/J2EE consulting --
http://www.arc-mind.com/consulting.htm#StrutsMentoring

-Original Message-
From: Andrew Hill [mailto:[EMAIL PROTECTED]
Sent: Monday, January 12, 2004 7:41 PM
To: Struts
Subject: RE: Mandatory use of form rather than request object


Yeh, your right though. Taking it out is a bit drastic and the request
object tends to be needed for various other things as well so denying access
to it is probably going to cause other problems.

Best thing really is to reeducate the developers. (Electric shocks work
wonderfully here - though  best check that your company doesnt have an OHS
policy against it first ;-> )

-Original Message-
From: Patrick Cheng [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 13 January 2004 10:34
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: RE: Mandatory use of form rather than request object


Hi,
I understand that the request.getParameter should not be used when the
info is readily available in the 'form' object.
But can we really take it out? When I create a list of records in a
table, with links to each record details, I would be generating an
 object with parameters attached, resulting in sth like: . Then I need to use the
request.getParameter to get the id, then retrieve the record details
from db.  So my question is, is there a way to get around this, so I can
get rid of request.getParameter completely?

Rgds,
Patrick.



-Original Message-
From: Andrew Hill [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 13, 2004 10:09 AM
To: Struts Users Mailing List
Subject: RE: Mandatory use of form rather than request object


No. He would provide setters in the form for anything that needs to be
passed along in request scope. This has the dual advantages of type
safety and making the design more explicit to anyone reading the code.

-Original Message-
From: Brice Ruth [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 13 January 2004 02:25
To: Struts Users Mailing List
Subject: Re: Mandatory use of form rather than request object


This precludes you from storing data in the request scope, though - so
you're left with only storing things in the session scope, which I
wouldn't consider ideal.

Right?

Richard Hightower wrote:

>Create a superclass that overides the execute method and calls an
>abstract execute method that does not pass the request object. The
>subclasses overide the execute method without the request object being
>passed.
>
>Also look into the ProcessAction, which is part of the scaffold.
>
>You can get the scaffold code by downloading the struts source.
>
>
>Rick Hightower
>Developer
>
>Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm
>
>Struts/J2EE consulting --
>http://www.arc-mind.com/consulting.htm#StrutsMentoring
>
>-Original Message-
>From: Abhishek Srivastava [mailto:[EMAIL PROTECTED]
>Sent: Monday, January 12, 2004 8:19 AM
>To: 'Struts Users Mailing List'
>Subject: Mandatory use of form rather than request object
>
>
>Hello All,
>
>I did some code reviews recently for my project being done on struts.
>
>I found that most people still do a request.getAttribute("NAME") kind
>of code even when the name is a property of the form object and is
>available
in
>the form object.
>
>My question is should the use of form be mandatory. If yes, how it can
>be enforced. Is there quick way I can remove all the params/attributes
>from
the
>request object once the corresponding values have been set in the form
>object?
>
>Thanks in advance for your advise.
>
>Regards,
>Abhishek.
>
>-
>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]
>
>
>

--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.


-
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]


-
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: Mandatory use of form rather than request object

2004-01-13 Thread Richard Hightower
H this is a good point.

In the past I have created a map wrapper that wraps the request object and
session object and passed those as well.
the advantage is that the execute method is a little easier to test since it
does not rely on the servlet API.

The execute method would look something like this:


protected abstract String execute(ActionForm form, Map request, Map
session);

The string is the name of the forward. Again, the advantage from a TDD
perspective is I can easily write tests for the above.

I think I have an example of this approach in the Mastering Tomcat book (I
wrote about 1/5 of that). I do not have an example of this in the
Professional Struts book, but there would be if I had the often elusive more
time.

I was thinking of taking the approach in the ProcessAction from scaffold and
the PicoContainer (or something of that ilk), and doing something similar
with more of an IOC (just as soon as I get some more time).


Rick Hightower
Developer

Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm

Struts/J2EE consulting --
http://www.arc-mind.com/consulting.htm#StrutsMentoring


-Original Message-
From: Brice Ruth [mailto:[EMAIL PROTECTED]
Sent: Monday, January 12, 2004 11:25 AM
To: Struts Users Mailing List
Subject: Re: Mandatory use of form rather than request object


This precludes you from storing data in the request scope, though - so
you're left with only storing things in the session scope, which I
wouldn't consider ideal.

Right?

Richard Hightower wrote:

>Create a superclass that overides the execute method and calls an abstract
>execute method that does not pass the request object.
>The subclasses overide the execute method without the request object being
>passed.
>
>Also look into the ProcessAction, which is part of the scaffold.
>
>You can get the scaffold code by downloading the struts source.
>
>
>Rick Hightower
>Developer
>
>Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm
>
>Struts/J2EE consulting --
>http://www.arc-mind.com/consulting.htm#StrutsMentoring
>
>-Original Message-
>From: Abhishek Srivastava [mailto:[EMAIL PROTECTED]
>Sent: Monday, January 12, 2004 8:19 AM
>To: 'Struts Users Mailing List'
>Subject: Mandatory use of form rather than request object
>
>
>Hello All,
>
>I did some code reviews recently for my project being done on struts.
>
>I found that most people still do a request.getAttribute("NAME") kind of
>code even when the name is a property of the form object and is available
in
>the form object.
>
>My question is should the use of form be mandatory. If yes, how it can be
>enforced. Is there quick way I can remove all the params/attributes from
the
>request object once the corresponding values have been set in the form
>object?
>
>Thanks in advance for your advise.
>
>Regards,
>Abhishek.
>
>-
>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]
>
>
>

--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.


-
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: Mandatory use of form rather than request object

2004-01-13 Thread Richard Hightower
forgive mebut could'nt your form have an id property?

then your action's execute method could get the id from the form.

Rick Hightower
Developer

Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm

Struts/J2EE consulting --
http://www.arc-mind.com/consulting.htm#StrutsMentoring

-Original Message-
From: Patrick Cheng [mailto:[EMAIL PROTECTED]
Sent: Monday, January 12, 2004 7:34 PM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: RE: Mandatory use of form rather than request object


Hi,
I understand that the request.getParameter should not be used when the
info is readily available in the 'form' object.
But can we really take it out? When I create a list of records in a
table, with links to each record details, I would be generating an
 object with parameters attached, resulting in sth like: . Then I need to use the
request.getParameter to get the id, then retrieve the record details
from db.  So my question is, is there a way to get around this, so I can
get rid of request.getParameter completely?

Rgds,
Patrick.



-Original Message-
From: Andrew Hill [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 13, 2004 10:09 AM
To: Struts Users Mailing List
Subject: RE: Mandatory use of form rather than request object


No. He would provide setters in the form for anything that needs to be
passed along in request scope. This has the dual advantages of type
safety and making the design more explicit to anyone reading the code.

-Original Message-
From: Brice Ruth [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 13 January 2004 02:25
To: Struts Users Mailing List
Subject: Re: Mandatory use of form rather than request object


This precludes you from storing data in the request scope, though - so
you're left with only storing things in the session scope, which I
wouldn't consider ideal.

Right?

Richard Hightower wrote:

>Create a superclass that overides the execute method and calls an
>abstract execute method that does not pass the request object. The
>subclasses overide the execute method without the request object being
>passed.
>
>Also look into the ProcessAction, which is part of the scaffold.
>
>You can get the scaffold code by downloading the struts source.
>
>
>Rick Hightower
>Developer
>
>Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm
>
>Struts/J2EE consulting --
>http://www.arc-mind.com/consulting.htm#StrutsMentoring
>
>-Original Message-
>From: Abhishek Srivastava [mailto:[EMAIL PROTECTED]
>Sent: Monday, January 12, 2004 8:19 AM
>To: 'Struts Users Mailing List'
>Subject: Mandatory use of form rather than request object
>
>
>Hello All,
>
>I did some code reviews recently for my project being done on struts.
>
>I found that most people still do a request.getAttribute("NAME") kind
>of code even when the name is a property of the form object and is
>available
in
>the form object.
>
>My question is should the use of form be mandatory. If yes, how it can
>be enforced. Is there quick way I can remove all the params/attributes
>from
the
>request object once the corresponding values have been set in the form
>object?
>
>Thanks in advance for your advise.
>
>Regards,
>Abhishek.
>
>-
>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]
>
>
>

--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.


-
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]

-
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]