Re: Pass parameters between Action classes

2002-03-23 Thread Jim Crossley

As long as the first action's forward element in struts-config refers
to an Action servlet and not a jsp, your example should work.
Something like this maybe:


  



"Enrique Rodriguez" <[EMAIL PROTECTED]> writes:

> I'm very newbie with struts and i have one question:
> 
> Is possible pass paramter throwugh action classes???
> 
> I explain it better??
> 
> Action 1:
> String param = "param";
> request.setAttribute("param", param);
> return (mapping.findForward ("Action2"));
> 
> Action 2:
> String param = (String)request.getAttribute("param");
> 
> 
> I'm trying to do it but its imposible. The only way to pass parameters is
> with a Form class.
> 
> What am I doing wrong???
> 
> Thanks in advance and pardon for my english, Enrique.
> 
> _
> Enrique Rodriguez Lasterra
> 
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 

-- 
Jim Crossley
http://www.lads.com/~jim

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Pass parameters between Action classes

2002-03-23 Thread Enrique Rodriguez

I'm very newbie with struts and i have one question:

Is possible pass paramter throwugh action classes???

I explain it better??

Action 1:
String param = "param";
request.setAttribute("param", param);
return (mapping.findForward ("Action2"));

Action 2:
String param = (String)request.getAttribute("param");


I'm trying to do it but its imposible. The only way to pass parameters is
with a Form class.

What am I doing wrong???

Thanks in advance and pardon for my english, Enrique.

_
Enrique Rodriguez Lasterra


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: struts 1.0.2 and jdk 1.4 build error some methods of java.sql.connection unimplemented

2002-03-23 Thread Niall Pemberton

See

http://www.mail-archive.com/struts-dev@jakarta.apache.org/msg05322.html

> -Original Message-
> From: Sukhwinder Singh [mailto:[EMAIL PROTECTED]]
> Sent: 22 March 2002 21:02
> To: [EMAIL PROTECTED]
> Subject: struts 1.0.2 and jdk 1.4 build error some methods of
> java.sql.connection unimplemented
> 
> 
> I am trying to compile jakarta-struts-1.0.2 source on Windows, 
> Ant 1.4. I am using Jdk 1.4 beta so some methods of 
> java.sql.connection are not implemented by 
> org.apache.struts.util.GenericConnection. These methods are 
> set/getHolidability and() setSavePoint().
> 
> Is there any way to compile it using Jdk 1.4.
> 
> -ANT--
> 
> prepare.library:
> 
> compile.library:
> [javac] Compiling 21 source files to 
> E:\jakarta-struts-1.0.2-src\target\library\classes
> 
> [javac] 
> E:\jakarta-struts-1.0.2-src\src\share\org\apache\struts\util\Generic
> Connection.java:97: org.apache.struts.util.GenericConnection 
> should be declared
> abstract; it does not define setHoldability(int) in 
> org.apache.struts.util.Gener
> icConnection
> [javac]  * Construct a new GenericConnection wrapping the 
> specified conn
> ection.
> [javac]^
> [javac] Note: Some input files use or override a deprecated API.
> [javac] Note: Recompile with -deprecation for details.
> [javac] 1 error
> 
> BUILD FAILED
> 
> E:\jakarta-struts-1.0.2-src\build.xml:195: Compile failed, 
> messages should have
> been provided.
> 
> Total time: 41 seconds
> 

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Nested tag tutorial

2002-03-23 Thread P. G.

The tutorial may be found at: www.keyboardmonkey.com/struts

I also had problems very similar to yours except that I was using an 
ArrayList instead of a vector.  I did the nested tags tutorial, and it has 
been smooth sailing ever since.

Cheers,
Ubiqueman


>From: "Perpetua Cysne" <[EMAIL PROTECTED]>
>Reply-To: "Perpetua Cysne" <[EMAIL PROTECTED]>
>To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>Subject: Re: Nested tag tutorial
>Date: Sat, 23 Mar 2002 00:13:16 -0500
>
>Hello,
>How do I get this tutorial?
>Cheers,
>Perpetua
>- Original Message -
>From: <[EMAIL PROTECTED]>
>To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>Sent: Tuesday, March 19, 2002 5:52 PM
>Subject: Nested tag tutorial
>
>
> >
> > The nested tag tutorial created by Arron Bates simply rocks!I was 
>kind
> > of intimidated by nested tags until I took a few hours out of my day to 
>go
> > thru parts 1 and 2 of the tutorial.   Thanks to the way it was well laid
> > out AND interesting, nested tags are no longer intimidating.Thanks 
>to
> > Arron on this one for a job well done.Can't recommend it enough.
>Is
> > his tutorial easy to follow?   I'm a total idiot/moron and his tutorial
> > made it easy to learn nested tags.
> >
> > Thanks Arron.
> >
> >
> > --
> > To unsubscribe, e-mail:
>
> > For additional commands, e-mail:
>
> >
>
>
>--
>To unsubscribe, e-mail:   
>
>For additional commands, e-mail: 
>
>





Ubiqueman's Iron Maiden and Heavy Metal Bootlegs
http://www.geocities.com/ubiqueman


_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Using MessageTag for handling plural/singular

2002-03-23 Thread Fabien Modoux

I am trying to use the Message tag to handle the display of plural vs.
singular. I tried the following simple example but it does not work as
ChoiceFormat requires a Number but MessageTag's argN are of type String.

> jsp:

<% for (int i = 0; i < 5; i++) { %>

<% } %>

> application resources:

test1=There {0,choice,0#are no files|1#is one file|2#are {0,number,integer}
files}.

> error:

java.lang.IllegalArgumentException: Cannot format given Object as a Number
at java.text.NumberFormat.format(NumberFormat.java:209)
at java.text.Format.format(Format.java:121)
at java.text.MessageFormat.format(MessageFormat.java:742)
at java.text.MessageFormat.format(MessageFormat.java:491)
at java.text.Format.format(Format.java:121)
at
org.apache.struts.util.MessageResources.getMessage(MessageResources.java:325
)
at org.apache.struts.util.RequestUtils.message(RequestUtils.java:586)
at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:239)


Has anyone found a workaround for this, or is there another way to do it?

Thanks in advance,

Fabien

-
Fabien Modoux,
Voicemate - http://www.voicemate.com


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: reg Forward action

2002-03-23 Thread Mikael Eriksson

Hi

  Since the perform method should take an ActionForm as its form parameter
and not an ReferralForm your perform is probably not called at all...
change the declaration and cast the form to a ReferralForm inside.

If you do get inteo the perform method, try to put in some more trace printouts
to see that you are not returning null or something like that.

  Regards
  Mikael


At 17:58 2002-03-22 -0500, you wrote:

>Hi
>
>I am trying to forward request from my Action class to a JSP (which is
>configured for forward aciton in struts-config.xml).
>When i submit the page i see the action is fired but it is not forwarding
>the request to specified JSP. since i could see no
>output on my browser . When i see my jsp_servlet folder the corresponding
>class file for the forwarded JSP is not found.
>
>
>public final class ReferralLoginCompleteAction extends Action {
> public ActionForward perform(ActionMapping mapping,
>  ReferralForm form,
>  HttpServletRequest request,
>  HttpServletResponse response)
> throws IOException, ServletException {



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: Liferay Enterprise Portal 1.1 Available

2002-03-23 Thread John Menke

Brian,

will there be a listserv available for Liferay developers?  

-john



> -Original Message-
> From: Brian Chan [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, March 23, 2002 3:10 AM
> To: [EMAIL PROTECTED]
> Subject: Liferay Enterprise Portal 1.1 Available
> 
> 
> Hey All,
> 
> Liferay Open Source Portal v1.1 is now built on top of Struts 1.1 
> beta. The portal server provides personalization (similar to 
> Yahoo!) and web mail (similar to Hotmail) and many other content 
> management tools.
> 
> You can see a demo and download it at http://www.liferay.com
> 
> It is made available under the MIT Open Source License (similar to BSD).
> 
> - Brian Chan ([EMAIL PROTECTED])
> 

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: Liferay Enterprise Portal 1.1 Available

2002-03-23 Thread John Menke

Brian,

this is great!  Thank you 

> -Original Message-
> From: Brian Chan [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, March 23, 2002 3:10 AM
> To: [EMAIL PROTECTED]
> Subject: Liferay Enterprise Portal 1.1 Available
> 
> 
> Hey All,
> 
> Liferay Open Source Portal v1.1 is now built on top of Struts 1.1 
> beta. The portal server provides personalization (similar to 
> Yahoo!) and web mail (similar to Hotmail) and many other content 
> management tools.
> 
> You can see a demo and download it at http://www.liferay.com
> 
> It is made available under the MIT Open Source License (similar to BSD).
> 
> - Brian Chan ([EMAIL PROTECTED])
> 

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Liferay Enterprise Portal 1.1 Available

2002-03-23 Thread Brian Chan

Hey All,

Liferay Open Source Portal v1.1 is now built on top of Struts 1.1 beta. The portal 
server provides personalization (similar to Yahoo!) and web mail (similar to Hotmail) 
and many other content management tools.

You can see a demo and download it at http://www.liferay.com

It is made available under the MIT Open Source License (similar to BSD).

- Brian Chan ([EMAIL PROTECTED])


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 


struts 1.0.2 and jdk 1.4 build error some methods of java.sql.connection unimplemented

2002-03-23 Thread Sukhwinder Singh

I am trying to compile jakarta-struts-1.0.2 source on Windows, Ant 1.4. I am using Jdk 
1.4 beta so some methods of java.sql.connection are not implemented by 
org.apache.struts.util.GenericConnection. These methods are set/getHolidability and() 
setSavePoint().

Is there any way to compile it using Jdk 1.4.

-ANT--

prepare.library:

compile.library:
[javac] Compiling 21 source files to 
E:\jakarta-struts-1.0.2-src\target\library\classes

[javac] E:\jakarta-struts-1.0.2-src\src\share\org\apache\struts\util\Generic
Connection.java:97: org.apache.struts.util.GenericConnection should be declared
abstract; it does not define setHoldability(int) in org.apache.struts.util.Gener
icConnection
[javac]  * Construct a new GenericConnection wrapping the specified conn
ection.
[javac]^
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -deprecation for details.
[javac] 1 error

BUILD FAILED

E:\jakarta-struts-1.0.2-src\build.xml:195: Compile failed, messages should have
been provided.

Total time: 41 seconds



Tiles question: Is it possible to insert a ComponentDefinition into a Tile context dynamically?

2002-03-23 Thread Chris Cool

Hi,

I have a tile that reads items from a PutList list and then inserts each
item into the current page. 

   
   
   

When the items in the list are tiles defined in my tileDefinitions.xml file,
the tiles are inserted into my JSP correctly. However, I want to dynamically
create a tile definition and insert it into the page context. 

I am generating the ComponentDefinition in my tile controller and accessing
the "itemList" where I add the name of the dynamically generated definition:

  /* get the item list and insert new tile def into it */
  ArrayList itemList = (ArrayList)context.getAttribute("itemList");
  if (itemList != null) {

HashMap map = new HashMap();
map.put("name", "newtarget");
map.put("link", "newtarget.do");

ComponentDefinition newItem = 
new ComponentDefinition("new.item",
  "/mytiles/simpleItem.jsp",
map);

DefinitionsUtil.setActionDefinition( request, breadCrumbItem );
itemList.add("new.item");
  }

In my tile, the "itemList" contains the "new.item" entry, but it does not
appear to find the ComponentDefinition I created.

Thanks for you help.

Chris

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Application without cookies and sessions

2002-03-23 Thread Sean Willson

There are a number of ways this can be handled. You can set your timeout 
at a larger value but then you can have memory bloat if there are to 
many sessions. You can also create an object that implements the 
HttpSessionListener or HttpSessionBindingListener interface. When the 
user logs in place this object in their session, this object being the 
user object you want to save or the state you want to save. Be sure it 
implements one of both of those interfaces. Then when the container 
attempts to remove or destroy the session you can save the users data 
either to the database or serialize it somewhere to flat file, that's up 
to you. You can then as a part of the login process on your site check 
for serialized user data somewhere (database or flat file depending on 
how you implemented) and load that data back into their session. That 
way you don't lose any data they may have saved.

Hope this helps some ... don't be afraid of sessions, just make sure you 
intelligently manage them.

Sean


Enrique Rodriguez wrote:
> Hi Nicolas,
> 
> First of all, thank you very much for your response.
> 
> What about the session timeout??? I don't like websites that if you left it
> for ten minutes you have to login again.
> 
> Is there any way to do a site without take care of session timeouts??
> 
> Regards, and pardon for my english.
> 
> Enrique.
> 
> _
> Enrique Rodriguez Lasterra
> 
> 



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: HOWTO: Lessons learned from using Struts, Tomcat and Oracle

2002-03-23 Thread Martin Samm

alternatively, use poolman, which although 'dead' can still be had from 
Sourceforge. i'm also using Struts / Tomcat (3.2 however) and Oracle (all on 
*nix). I haven't tried Tomcat / Struts pooling, but opted for poolman instead 
and found it easy to setup

On Friday 22 Mar 2002 12:04 pm, you wrote:
>  Original Message 
> Subject: Lessons learned from using Struts, Tomcat and Oracle
> Date: Thu, 21 Mar 2002 19:43:22 -0800 (PST)
> From: "Walter S. So" <[EMAIL PROTECTED]>
>
> Hi Ted,
>
> I just want to share this information in case someone else also
> goes through the same problems I did.  I was able to come up
> with this solution after spending an entire afternoon searching
> through the net and archives, so if it saves people a few hours
> of debugging, I'll be happy.  I am not sure how to categorize it
> or even which mailing list to send this, whether it should go to
> Tomcat, Struts, or Tyrex, so I decided to send it to you since
> you are active in Jakarta.
>
> My goal was to set up a Connection Pooled DataSource using
> Oracle running Struts on Tomcat.  I use Tomcat 4.0.3, Struts
> 1.1-b1-lib, Oracle 8.1.7 "classes12.zip" running on Windows 98,
> but it should work well on Solaris/Linux.
>
> Initially, I set up the Oracle JDBC drivers under my webapp and
> used the  in struts-config.xml to access Oracle.  My
> application consistently hung after the pool was exhausted.
> (For example, if I set the minCount and maxCount to "10", my
> webapp would hang after 10 requests)  The problem of Oracle
> connections not being returned properly by the Struts pool was
> well documented in the mailing list, so I switched the
> datasource from struts-config.xml to tomcat's server.xml.  I
> followed the instructions in the Tomcat jndi-resources-howto and
> copied the Oracle drivers to common/lib after renaming the
> "classes12.zip" to "classes12.jar" as suggested by the mailing
> list.
>
> I found my webapp wasn't running properly as the servlet would
> stop executing after context.lookup().  This bothered me because
> Tomcat was not throwing any exceptions. After some more
> research, I changed the debug level in server.xml from "0" to
> "99".  This time, the log generated showed a
> java.lang.ClassCastException: tyrex.jdbc.xa.EnabledDataSource
> when the lookup() is called.  A post in the tomcat-dev mailing
> list provided the answer:  There was a conflict in the jars of
> tomcat and the webapp.  True enough, I found a
> jdbc2_0-stdext.jar (83KB) that came in tomcat\common\lib, and a
> jdbc2_0-stdext.jar (7KB) that i had unpacked from Struts to my
> web-app.  After deleting the 7KB jar, the lookup() executed
> properly.
>
> To sum up, when using a DataSource in Tomcat and Struts in the
> webapp, make sure to remove the extraneous jdbc2_0-stdext.jar
> that comes with the Struts Lib. :)
>
> Hope that helps,
>
> Walter
>
>
> __
> Do You Yahoo!?
> Yahoo! Movies - coverage of the 74th Academy Awards®
> http://movies.yahoo.com/

-- 
Martin Samm
[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: Using 2.3 Filters and Struts

2002-03-23 Thread Todd G. Nist

John,

The actual filter in deployment here only stores the user object once in the
session.  I thought that was a major oversight on my part and I had to go
check the actual code when you mentioned it; Thanks for the comment.  The
filter, checks to see if the user object is valid and if not, but the user
has been authenticated by the container, then the user object is created and
stored in the session, otherwise the user is sent to an error.jsp or
login.jsp page.  From that point, the filter always checks the user object
in the session, but does not create it again.  This was left out during the
cutting and pasting of code, sorry about that.  So with regards to you first
question/comment, I would agree with creating the user object only once.

Our filter mapping is handled at the /app/do/* and /app/pages/ level where
app is the specific web application.  All our actions are currently mapped
to the /do/* and you are required to be logged in to perform any action
under specific applications, i.e. a Buyer Site and Supplier Site exchange
type application.  We also have the basic portal or informational site which
is a different /app and requires no authentication to get into.  All .jsp's
are stored in the pages directory with the exception of those required to
support the login.jsp, error.jsp and index.jsp.

When a user first hits the site they are presented with the index.jsp which
is using tiles to define the screen layout.  One of the tiles created is the
"login" tile which allows a valid user to login to either/or the
Buy/Supplier Site.  The links for Buyer/Supplier point to an action
/app/do/loginAct?action=Buyer  or /app/do/loginAct?action=Supplier. Since
the /app/do is a protected resource the container presents the Form based
login.jsp page.  If the user is authenticated, we get the request in the
filter, create the user object, and the pass the action to the loginAct.
The login action is our case does little more then forward the user to the
appropriate page based on login success.  If there are any problems with the
login, the filter catches them and forwards the user to an error.jsp page
with the appropriate error messages.

The above could be done just as easily in the action, but we opted to do it
in the filter since at some point we my use our on security model and by
pass the container implementation completely.  So by doing things here in
the filter, we are all set if we decide for any reason we need to change the
flow of the application. (I think)

Regards,
Todd



-Original Message-
From: John Regan [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 21, 2002 12:49 PM
To: 'Struts Users Mailing List'
Subject: RE: Using 2.3 Filters and Struts


Thanks Todd!
I've developed a very similar solution.  Here are a couple of
questions/comments about the code:
1. I noticed that you are storing the user object in the session every time
this filter is invoked with a valid user.  My solution sets the user object
once in the session after a successful login in the LoginAction class.  Do
you see any issues with setting it once?
2.How do you handle the filter mapping?  Do you have a directory that
contains all the pages that a user has to be logged in to be able to view?

Thanks for the help,
JBR

-Original Message-
From: Todd G. Nist [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 21, 2002 7:09 AM
To: 'Struts Users Mailing List'
Subject: RE: Using 2.3 Filters and Struts


In your filter, you can do something like the below.  We have implemented
something similar to this but have container managed security on top of it.
So the container managed security gets invoked first and then the filter,
processes the request.  This lets us add any additional information to the
session to ensure "logged inness".  Now when the session times out, the any
resource which is protected is first processed by the container managed
security, and then the filter is invoked.

You could just as easily use only the filter for ensuring "logged inness".

Hope the below helps.

Regards,
Todd G. Nist

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;

public class SecurityFilter implements Filter {

private FilterConfig config = null;
private ServletContext ctx = null;
private User user = null;

public void init(FilterConfig config) throws ServletException {
this.config = config;
this.ctx = config.getServletContext();
this.ctx.log("Filter SecurityFilter initialized.");
}

public void destroy() {
this.user = null;
this.ctx = null;
this.config = null;
}

public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException,
ServletException {

HttpServletRequest req = (HttpServletRequest)request;
String action = null;

ctx.log("User is: " + req.get

RE: Application scope beans

2002-03-23 Thread Etienne, Ingo (Goetzfried AG)

Try this in a Action instance:

javax.servlet.ServletContext ctx =
this.getServlet().getServletContext();
Object obj = ctx.getAttribute("key");
ctx.setAttribute("key", obj);


-Original Message-
From: John Jones [mailto:[EMAIL PROTECTED]]
Sent: Samstag, 23. März 2002 17:00
To: Struts Users Mailing List
Subject: Application scope beans


Does anyone out there know how to access objects in application scope from a
servlet? We want to have a startup servlet that puts a bunch of beans in
application scope on application server startup.

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Application scope beans

2002-03-23 Thread John Jones

Does anyone out there know how to access objects in application scope from a servlet? 
We want to have a startup servlet that puts a bunch of beans in application scope on 
application server startup.



Re: getting validation errors on initial display of a form

2002-03-23 Thread Anant Sagar

Since you are calling "names.do"   directly, formbean calls validate() method before 
forwarding to appropriate action class and hence the erros are displayed.
Call your form using this  http://localhost:8080/starrd/pages/app/Name.jsp   initially 
 
and set action="/app/names" while  submitting. 
Hope that may help .

Anant Sagar

- Original Message - 
From: "Dick Starr" <[EMAIL PROTECTED]>
To: "struts-user" <[EMAIL PROTECTED]>
Sent: Tuesday, January 22, 2002 8:50 AM
Subject: getting validation errors on initial display of a form


> I am new to Struts and am using Ted's sample logon app as my basis for
> learning. His part works fine. I added a new jsp page that contains two
> fields, created a form bean & an action form with validation edits. My
> problem is that when I execute my form via
> http://localhost:8080/starrd/app/names.do I get validation errors appearing
> immediately (before I enter any data in the form). I can't believe thats
> normal: I must be doing something wrong.
> 
> Thanks in advance for the help.
> 
> Dick Starr
> 
> Here's the pertinent parts of my struts-config:
> 
>   
>name="nameForm"
> type="com.starrcs.app.SANameForm"/>
> 
>   
>name="names"
>   path="/app/names.do"/>
> 
>   
>path="/app/names"
>   type="com.starrcs.app.SANameAction"
>   name="nameForm"
>   scope="request"
>   validate="true"
>   input="/pages/app/Name.jsp">
>name="continue"
> path="/pages/app/Name.jsp"/>
> 
> 
> Here's my Name.jsp:
> 
> 
> <%@ page language="java" %>
> <%@ taglib uri="/tags/struts-bean" prefix="bean" %>
> <%@ taglib uri="/tags/struts-html" prefix="html" %>
> 
> 
> 
> 
> 
> 
> Name:
>   
> 
> Address line one:
>   
> 
> 
> 
> 
> 
> 
> 
> 
> 
> <%--
> 
> Allow user to submit username and password to logon action.
> 
> --%>
> 
> Here's the pertinent parts of SANameAction.java:
> 
> public final class SANameAction extends Action
> {
>   public ActionForward perform(ActionMapping mapping,
> ActionForm form,
> HttpServletRequest request,
> HttpServletResponse response)
> throws IOException, ServletException
>   {
> // Obtain fields from web tier
> String name = ((SANameForm) form).getName();
> String addr1 = ((SANameForm) form).getAddr1();
> 
> // Log this event, if appropriate
> if (servlet.getDebug() >= SAConstants.DEBUG)
> {
>   StringBuffer message =
> new StringBuffer("SANameAction: name = ");
>   message.append(name);
>   message.append(", addr1 = ");
>   message.append(addr1);
>   servlet.log(message.toString());
> }
> 
> // Forward control to the welcome URI
> // specified in the configuration.
> return (mapping.findForward(SAConstants.WELCOME));
>   }
> 
> } // End SANameAction
> 
> Here's the pertinent parts of SANameForm.java:
> 
> public final class SANameForm extends ActionForm
> {
>   //  Instance Variables
> 
>   private String name = null;
>   private String addr1 = null;
> 
>   //  Properties
> 
>   public String getName()
>   {
> return (this.name);
>   }
> 
>   public void setName(String name)
>   {
> this.name = name;
>   }
> 
>   public String getAddr1()
>   {
> return (this.addr1);
>   }
> 
>   public void setAddr1(String addr1)
>   {
> this.addr1 = addr1;
>   }
> 
> //  Public Methods
> public void reset(ActionMapping mapping,
> HttpServletRequest request)
> {
>   setName(null);
>   setAddr1(null);
> }
> 
> public ActionErrors validate(ActionMapping mapping,
>  HttpServletRequest request)
> {
>   ActionErrors errors = new ActionErrors();
>   if ((name == null) || (name.length() < 1))
> errors.add("name",
>   new ActionError("app.error.name.required"));
>   if ((addr1 == null) || (addr1.length() < 1))
> errors.add("addr1",
>   new ActionError("app.error.addr1.required"));
>   return errors;
> }
> 
> } // End SANameForm
> 
> When I first execute the form via  http://localhost:8080/starrd/app/names.do
> I immediately (before entering any data or executing the submit button) I
> get validation errors displayed for name and addr1 and get the following in
> my log file:
> 
> 2002-01-21 20:19:19 action: Processing a GET for /app/names
> 2002-01-21 20:19:19 action:  Looking for ActionForm bean under attribute
> 'nameForm'
> 2002-01-21 20:19:19 action:  Creating new ActionForm instance of class
> 'com.starrcs.app.SANameForm'
> 2002-01-21 20:19:19 action:  Storing instance under attribute 'nameForm' in
> scope 'request'
> 2002-01-21 20:19:19 action:  Populating bean properties from this request
> 2002-01-21 20:19:19 action:  Validating input form properties
> 2002-01-21 20:19:19 action:   Validation error(s), redirecting to:
> /pages/app/Name.jsp
> 
> Then if I fill in the two fields with data, I do not get validation e

Re: reg Forward action

2002-03-23 Thread Anant Sagar

Try putting attribute input="/result.jsp" in tag and
call  "/loginComplete.do" only when you submit the form.
Hope that might help
Anant Sagar

- Original Message -
From: "Kumari, Ramana" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Saturday, March 23, 2002 4:29 AM
Subject: reg Forward action


>
> Hi
>
>I am trying to forward request from my Action class to a JSP (which is
> configured for forward aciton in struts-config.xml).
>When i submit the page i see the action is fired but it is not
forwarding
> the request to specified JSP. since i could see no
>output on my browser . When i see my jsp_servlet folder the
corresponding
> class file for the forwarded JSP is not found.
>
>My app is running on Weblogic 6.1 server.
>
>I am wondering if someone could help me in figuring out of what is
> happening !
>
>My Action Class follows
>
> public final class ReferralLoginCompleteAction extends Action {
> public ActionForward perform(ActionMapping mapping,
>  ReferralForm form,
>  HttpServletRequest request,
>  HttpServletResponse response)
> throws IOException, ServletException {
>
> System.out.println("in ReferralLoginCompleteAction perform() ");
> if (form instanceof ReferralForm) {
> ReferralForm theForm = (ReferralForm) form;
>   String dateReceived = theForm.getDateReceived();
>   String workerName =  theForm.getWorkerName();
>   String referralNumber =  theForm.getReferralNumber();
>
>   HttpSession session = request.getSession();
>
>   System.out.println("before forwarding "+ dateReceived
> +workerName+referralNumber);
>
> request.setAttribute("dateReceived", dateReceived);
> request.setAttribute("referralNumber",
> referralNumber);
> request.setAttribute("workerName", workerName);
>
>   return (mapping.findForward("referral"));
> }
> else
> return null;
>
> }
> }
>
>
>   My struts-config.xml file is in \web-inf\conf directory.
>   My classes are in \web-inf\classes  directory.
>
>   My struts configuration follows
>
> 
>   
>  type="assets.icr.referral.model.ReferralForm"/>
>   
>
>   
>   type="assets.icr.referral.webController.ReferralLoginCompleteAction"
>  name="referralForm"
>  scope="request">
> 
> 
>   
> 
>
> --
> To unsubscribe, e-mail:

> For additional commands, e-mail:



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Object Mapping w/ Struts?

2002-03-23 Thread James A. Hillyerd

I am looking for an object-mapping (to sql relational DB) solution for
Struts.  

I have a medium sized database application which I've developed in
struts.  (around 25 tables in PostgreSQL)  I've been using a home-brew
lightweight data-access bean system -- using perl scripts to generate
beans that interact with the database.  The java source these scripts
generate need a lot of manual editing, so making changes to the object
model can be a nightmare. 

I tried downloading Torque 2.1, but had problems, so then I tried Torque
3.0b1.  It seems like Torque isn't going to integrate well with my
already existing tables.  I use some postgres types such as TEXT and
BOOLEAN, which I would expect to map to LONGVARCHAR and BIT
respectively, but in the SQL that torque spit out they were "bytea" and
"".  I can't find mention of "bytea" in postgres docs, and obviously ""
isn't going to do much for me. =) 

After reading the Torque docs, I really like what it offers but I'm not
sure that it will work for me.  Are there any other solutions that
people can recommend?  Or should I try modifying torque to fit my needs?
I don't have any EJB experience but I've heard good things about JBoss. 
I've also heard the going EJB can really slow an application down. I've
also noticed some talk of Expresso on this list, would this be worth
trying?

Thanks for any advice! 

-james 

-- 
[]  James A. Hillyerd <[EMAIL PROTECTED]> - Java Developer
[]  PGP 1024D/D31BC40D F87B 7906 C0DA 32E8 B8F6 DE23 FBF6 4712 D31B C40D


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




getting validation errors on initial display of a form

2002-03-23 Thread Dick Starr

I am new to Struts and am using Ted's sample logon app as my basis for
learning. His part works fine. I added a new jsp page that contains two
fields, created a form bean & an action form with validation edits. My
problem is that when I execute my form via
http://localhost:8080/starrd/app/names.do I get validation errors appearing
immediately (before I enter any data in the form). I can't believe thats
normal: I must be doing something wrong.

Thanks in advance for the help.

Dick Starr

Here's the pertinent parts of my struts-config:

  
  

  


  

  


Here's my Name.jsp:


<%@ page language="java" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>






Name:
  

Address line one:
  









<%--

Allow user to submit username and password to logon action.

--%>

Here's the pertinent parts of SANameAction.java:

public final class SANameAction extends Action
{
  public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
  {
// Obtain fields from web tier
String name = ((SANameForm) form).getName();
String addr1 = ((SANameForm) form).getAddr1();

// Log this event, if appropriate
if (servlet.getDebug() >= SAConstants.DEBUG)
{
  StringBuffer message =
new StringBuffer("SANameAction: name = ");
  message.append(name);
  message.append(", addr1 = ");
  message.append(addr1);
  servlet.log(message.toString());
}

// Forward control to the welcome URI
// specified in the configuration.
return (mapping.findForward(SAConstants.WELCOME));
  }

} // End SANameAction

Here's the pertinent parts of SANameForm.java:

public final class SANameForm extends ActionForm
{
  //  Instance Variables

  private String name = null;
  private String addr1 = null;

  //  Properties

  public String getName()
  {
return (this.name);
  }

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

  public String getAddr1()
  {
return (this.addr1);
  }

  public void setAddr1(String addr1)
  {
this.addr1 = addr1;
  }

//  Public Methods
public void reset(ActionMapping mapping,
HttpServletRequest request)
{
  setName(null);
  setAddr1(null);
}

public ActionErrors validate(ActionMapping mapping,
 HttpServletRequest request)
{
  ActionErrors errors = new ActionErrors();
  if ((name == null) || (name.length() < 1))
errors.add("name",
  new ActionError("app.error.name.required"));
  if ((addr1 == null) || (addr1.length() < 1))
errors.add("addr1",
  new ActionError("app.error.addr1.required"));
  return errors;
}

} // End SANameForm

When I first execute the form via  http://localhost:8080/starrd/app/names.do
I immediately (before entering any data or executing the submit button) I
get validation errors displayed for name and addr1 and get the following in
my log file:

2002-01-21 20:19:19 action: Processing a GET for /app/names
2002-01-21 20:19:19 action:  Looking for ActionForm bean under attribute
'nameForm'
2002-01-21 20:19:19 action:  Creating new ActionForm instance of class
'com.starrcs.app.SANameForm'
2002-01-21 20:19:19 action:  Storing instance under attribute 'nameForm' in
scope 'request'
2002-01-21 20:19:19 action:  Populating bean properties from this request
2002-01-21 20:19:19 action:  Validating input form properties
2002-01-21 20:19:19 action:   Validation error(s), redirecting to:
/pages/app/Name.jsp

Then if I fill in the two fields with data, I do not get validation errors
(which is correct). Then this is what is in my log:

2002-01-21 20:19:37 action: Processing a POST for /app/names
2002-01-21 20:19:37 action:  Looking for ActionForm bean under attribute
'nameForm'
2002-01-21 20:19:37 action:  Creating new ActionForm instance of class
'com.starrcs.app.SANameForm'
2002-01-21 20:19:37 action:  Storing instance under attribute 'nameForm' in
scope 'request'
2002-01-21 20:19:37 action:  Populating bean properties from this request
2002-01-21 20:19:37 action:  Validating input form properties
2002-01-21 20:19:37 action:   No errors detected, accepting input
2002-01-21 20:19:37 action:  Looking for Action instance for class
com.starrcs.app.SANameAction
2002-01-21 20:19:37 action: SANameAction: name = data1, addr1 = data2
2002-01-21 20:19:37 action: Processing a POST for /app/welcome
2002-01-21 20:19:37 action:  Looking for Action instance for class
com.starrcs.app.SAContinueAction



--
To unsubscribe, e-mail:   
For additional commands, e-mail: