Where can I find taglibs

2005-07-28 Thread Paul Goepfert
I want to write a web app  with  jsp/struts.  I know that there should 
be a struts tag library for this.  Where can I find it?


Thanks,

-Paul

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



Re: Validation Help

2005-07-23 Thread Paul Goepfert
I have a question.  I have decided to use the vaildation framework to do 
the validation in my web app.  I have created a validation.xml file, and 
a vaildator-rules.xml file.  I noticed in books about struts that I have 
there is a properties file associated with the vaildation.   Am I right? 
If so I add it to my struts-config file, right?  


-Paul
Glen Mazza wrote:

http://www.objectsource.com/Struts_Survival_ Guide.pdf, Chapter 5.
Paul Goepfert wrote:
I have created a web app using struts and velocity.  I am going to 
add vaildation on the struts end of the app.  I am still learning 
struts.  The only thing I have been able to do is use struts to move 
between pages by way of buttons.Now I want to add validation to 
my web app.  I have  no  idea how to do it.


If anyone can help me out that would be great.

-Paul

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



Validation Help

2005-07-19 Thread Paul Goepfert
I have created a web app using struts and velocity.  I am going to add 
vaildation on the struts end of the app.  I am still learning struts.  
The only thing I have been able to do is use struts to move between 
pages by way of buttons.Now I want to add validation to my web app.  
I have  no  idea how to do it.


If anyone can help me out that would be great.

-Paul

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



Question about DispatchAction

2005-06-15 Thread Paul Goepfert
I am writing a web app that gets information from a user (first and last 
names, and their address (street, city, state, zip) ) and the user has 
the option to sort the data.  Based on direction(ascending or 
descending) and what to sort by.  Either first or last name. 

Now here is my question, I have four Action classes in my web app.  I 
have them in separate files.  Since I am just beginning to learn Struts 
I  was unaware of the DispatcherAction class.  Now that I am aware of it 
I am going to use it.  There is one question I have though,  What class 
does  my dispatchAction class extend from?  I assume its an extension of 
some class. 

Also, I'm not sure if this is the right place for this but I am having 
some object reference problems.  What's happening is that when I fill up 
the information form with the name and address, I then save those values 
to a bean.  Once I have all the values in a bean I then save that bean 
object into a vector.  Now it seams that when I insert a new name into 
the vector the first position of the vector is overwritten by the new 
info that is being saved into the second position.  However when I added 
a third name I don't have that same problem.  It just enters in 
correctly.  Now when I go and try and sort the contents of the vector 
there seems to be a new object reference.  So I guess my question is, 
Will the Dispatcher class help with this object reference problem?


-Paul

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



Re: Having ttruble with actions and buttons

2005-06-13 Thread Paul Goepfert
ok here is what I am talking about.  I have a form that takes in first 
name, last name, street address, city, state and zipcode.  When I press 
on the button to enter that information into a database.  I want the 
page to  reload with clear input fields. 


-Paul

Michael Jouravlev wrote:


What do you mean "clear out" and what do you mean by "reload"? If you
need a stateful component to obtain user data, and to be able to to
redisplay the page with error messages, and to store intermediate
data, and to correctly process Refresh and Back buttons, you might
want to take a look at the class that I put together last week:
http://struts.sourceforge.net/strutsdialogs

If you totally against storing data in the session, this class is not
for you, though ;-)

Michael.

P.S. Damn, that download counter did reset, when I updated the zip :-(
P.P.S. The live samples are not available right at this moment, the
server is down. It should be up soon.

On 6/13/05, Paul Goepfert <[EMAIL PROTECTED]> wrote:
 


I figured it out.  It was a stupid mistake, the mappings didn't match
between my struts-config and my Action Class.  By the way, the Dispacher
looks like a better way to handle actions.  I  don't suppose anyone
would know where I would call the reset method to clear out the form onn
a reload?

-Paul

Dave Newton wrote:

   


Paul Goepfert wrote:

 


[...]  try
  {
  session = request.getSession();
  action = request.getParameter("action");
  if(action.equals("enterInfo"))
  {
  return (mapping.findForward("enter"));
  }
  else if(action.equals("default"))
  {
  sorted = data.createSortedArray("ascending", "first");
  data.removeInsert(sorted);
  data.createContext(sorted);
  return (mapping.findForward("default"));
  }
  else
  {
  return  (mapping.findForward("sort"));
  }
  } [...]
   


This code reeks of code smell, regardless of any other issues,
especially if you have to do something similar in any other action.
This is, more or less, what DispatchAction (?) was created for. Here
you've duplicated controller logic inside an action, which is really
supposed to be a target of the controller.

So here you are expecting forwards named "enter", "default", and "sort".

 



 
   


menu

 


onchange="menu.action.value='enterInfo'"
   


$text.get("menuEnter")
 


enterInfo

 


onchange="menu.action.value='default'">$text.get("menuDefault")
   


default

 


onchange="menu.action.value='sort'">$text.get("menuSort")
   


sort

 







   

 


Okay, so that looks good.

Have you done a sanity check with a plain 'ol action with a forward to
a JSP like Frank suggested?

Have you put in logging statements to make sure that the action
parameter is what you expect it to be when you hit your action?

Have you been able to get _any_ Velocity file to render, i.e., hit one
without going through Struts? An the related Have you checked on the
Velocity list to make sure you have the VelocityViewServlet set up
properly?

Have you checked the log files for error messages?

Dave



-
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: Having ttruble with actions and buttons

2005-06-13 Thread Paul Goepfert
I figured it out.  It was a stupid mistake, the mappings didn't match 
between my struts-config and my Action Class.  By the way, the Dispacher 
looks like a better way to handle actions.  I  don't suppose anyone 
would know where I would call the reset method to clear out the form onn 
a reload?


-Paul

Dave Newton wrote:


Paul Goepfert wrote:


[...]  try
   {
   session = request.getSession();
   action = request.getParameter("action");   
   if(action.equals("enterInfo"))

   {
   return (mapping.findForward("enter"));
   }
   else if(action.equals("default"))
   {
   sorted = data.createSortedArray("ascending", "first");
   data.removeInsert(sorted);
   data.createContext(sorted);
   return (mapping.findForward("default"));
   }
   else
   {
   return  (mapping.findForward("sort"));
   }
   } [...]



This code reeks of code smell, regardless of any other issues, 
especially if you have to do something similar in any other action. 
This is, more or less, what DispatchAction (?) was created for. Here 
you've duplicated controller logic inside an action, which is really 
supposed to be a target of the controller.


So here you are expecting forwards named "enter", "default", and "sort".



  



menu

onchange="menu.action.value='enterInfo'"  
>$text.get("menuEnter")



enterInfo


onchange="menu.action.value='default'">$text.get("menuDefault")



default


onchange="menu.action.value='sort'">$text.get("menuSort")



sort



 
 
 





Okay, so that looks good.

Have you done a sanity check with a plain 'ol action with a forward to 
a JSP like Frank suggested?


Have you put in logging statements to make sure that the action 
parameter is what you expect it to be when you hit your action?


Have you been able to get _any_ Velocity file to render, i.e., hit one 
without going through Struts? An the related Have you checked on the 
Velocity list to make sure you have the VelocityViewServlet set up 
properly?


Have you checked the log files for error messages?

Dave



-
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: Having ttruble with actions and buttons

2005-06-13 Thread Paul Goepfert

Here is my MenuAction.java

package actions;

import org.apache.struts.action.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.Arrays.*;
import java.io.*;
import forms.*;
import beans.InfoBean;
import logic.DB;

public class MenuAction extends Action 
{

   public ActionForward execute(ActionMapping mapping, ActionForm form,
   HttpServletRequest request,
   HttpServletResponse response)
   throws IOException, ServletException
   {
   String action;
   HttpSession session;   


   DB data = new DB();
   InfoBean sorted [] = new InfoBean [data.getInformation().size()]; 
   try

   {
   session = request.getSession();
   action = request.getParameter("action");


   if(action.equals("enterInfo"))
   {
   return (mapping.findForward("enter"));
   }
   else if(action.equals("default"))
   {
   sorted = data.createSortedArray("ascending", "first");
   data.removeInsert(sorted);
   data.createContext(sorted);
   return (mapping.findForward("default"));
   }
   else
   {
   return  (mapping.findForward("sort"));
   }
   }
   catch (Exception e)
   {
   e.printStackTrace();
   }
   return (mapping.findForward("menu"));
   }
}


I am also including part of the webpage source file incase the problem 
is in there and its a html error.



  
   
   
   
   $text.get("menuEnter")
   
   
   
   
   $text.get("menuDefault")
   
   
   
   
   $text.get("menuSort")
   
   
   
   
   

The $text variable is a varable that is defined in the velocity tools  
package. The variables are defined in a properties file I defined.  When 
displayed on the web the $text variable is exchanged with the mapping in 
the properties file.


-Paul

Frank W. Zammetti wrote:


On Mon, June 13, 2005 12:54 am, Paul Goepfert said:
 


Well I just created a test jsp file to see if I got to the page.  I
didn't.  I just want to  be sure about one thing.  I am soppose to have
multiple actions in my struts config? One for each  page? Right?
   



How your app is configured is completely up to you... there are no rules
per se (there's some commonly-accepted pattersn though).  You might have
10 Actions for a single page (reasonable in some cases), or one Action for
10 pages (probably not a good idea generally), or one per page (most
common I'd say), or something else I haven't thought of.

I'm guessing, based on the config you posted, that you are submitting a
form to /Menu when any of a number of menu items are clicked?  Then in the
Action you are determine which was clicked and forwarding to the
appropriate Velocity template?  If so, that's a reasonable approach...
some would say you should probably use a DispatchAction, but it's more a
matter of what you prefer than what is right or wrong.

Now... why you aren't seeing the JSP... I think you want to solve that
before anything else... The first thing to do is be sure what forward is
being returned... As a matter of fact, how about posting your Action's
code?  I assume it isn't too big... There might be something obvious that
I or someone else can point out right away... You either have something
configured wrong, or the Action's code is wrong... Are you sure the Action
is being reached at all?  If so then most of your configuration it
obviously correct, the only remaining point could be the forward
declarations.  Nothing stands out as wrong to me though, so seeing the
code might help.

Frank

 


-Paul

Frank W. Zammetti wrote:

   


Ok... I probably can't be of too much help then... I've never used
Velocity.

One thing to try though... change your forwards to go to a test JSP...
if you get to it, then the problem is in the Velocity side of things
(or the forward to the Velocity templates).  At least you'll narrow
down your focus a bit.

Frank

Paul Goepfert wrote:

 


I am forwarding to a web page.  The .vm file extension is mapped to
org.apache.velocity.tools.view.servlet.VelocityViewServlet.  I am
using Apache Velocity for my Web page design.  Should I be forwarding
to Actions?

My intention is to go to a Velocity page rather then an html or JSP.

-Paul
Frank W. Zammetti wrote:

   


What are you forwarding to in this mapping Paul?  Is .vm the
extension your application uses to map to ActionServlet, in

Re: Having ttruble with actions and buttons

2005-06-12 Thread Paul Goepfert
Well I just created a test jsp file to see if I got to the page.  I 
didn't.  I just want to  be sure about one thing.  I am soppose to have 
multiple actions in my struts config? One for each  page? Right?


-Paul

Frank W. Zammetti wrote:

Ok... I probably can't be of too much help then... I've never used 
Velocity.


One thing to try though... change your forwards to go to a test JSP... 
if you get to it, then the problem is in the Velocity side of things 
(or the forward to the Velocity templates).  At least you'll narrow 
down your focus a bit.


Frank

Paul Goepfert wrote:

I am forwarding to a web page.  The .vm file extension is mapped to 
org.apache.velocity.tools.view.servlet.VelocityViewServlet.  I am 
using Apache Velocity for my Web page design.  Should I be forwarding 
to Actions?


My intention is to go to a Velocity page rather then an html or JSP.

-Paul
Frank W. Zammetti wrote:

What are you forwarding to in this mapping Paul?  Is .vm the 
extension your application uses to map to ActionServlet, in which 
case you are forwarding to Actions?  Or is it something else?


Most commonly, the forwards go to JSPs (although not necessarily).

You are correct in your thinking with regard to what Martin said... 
there are no special meaning forward names that I am aware of, you 
can name your forwards whatever you wish.  Success and Failure are 
two very common names however.


Is your intention to go to a JSP when you return a given forward 
from your Action?  If so, I suspect that is what is wrong... change 
the paths  on the forwards... if your intention is something else, 
please explain so we can try and help :) 






Frank

Paul Goepfert wrote:

Ok, here is the problem.  When I load up my web app the page loads 
fine.  When I try to advance to another web page in my web app all 
I get is a blank screen.  For every page I have a form.java and an 
action.java file so I can move through the web app.  Here is part 
of my struts-config file that handles the actions.



  
  
  


In the form.java files I have getters and setters for the 
information I pass through the address bar.  In the action.java 
files I  have method calls to my logic for the program as well as 
forwards for the next page I wannt to go to.


If anyone can help me out that would be great.  If more information 
is needed let me know.


-Paul

-
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: Having ttruble with actions and buttons

2005-06-12 Thread Paul Goepfert
I am forwarding to a web page.  The .vm file extension is mapped to 
org.apache.velocity.tools.view.servlet.VelocityViewServlet.  I am using 
Apache Velocity for my Web page design.  Should I be forwarding to Actions?


My intention is to go to a Velocity page rather then an html or JSP.

-Paul
Frank W. Zammetti wrote:

What are you forwarding to in this mapping Paul?  Is .vm the extension 
your application uses to map to ActionServlet, in which case you are 
forwarding to Actions?  Or is it something else?


Most commonly, the forwards go to JSPs (although not necessarily).

You are correct in your thinking with regard to what Martin said... 
there are no special meaning forward names that I am aware of, you can 
name your forwards whatever you wish.  Success and Failure are two 
very common names however.


Is your intention to go to a JSP when you return a given forward from 
your Action?  If so, I suspect that is what is wrong... change the 
paths  on the forwards... if your intention is something else, please 
explain so we can try and help :) 




Frank

Paul Goepfert wrote:

Ok, here is the problem.  When I load up my web app the page loads 
fine.  When I try to advance to another web page in my web app all I 
get is a blank screen.  For every page I have a form.java and an 
action.java file so I can move through the web app.  Here is part of 
my struts-config file that handles the actions.



  
  
  


In the form.java files I have getters and setters for the information 
I pass through the address bar.  In the action.java files I  have 
method calls to my logic for the program as well as forwards for the 
next page I wannt to go to.


If anyone can help me out that would be great.  If more information 
is needed let me know.


-Paul

-
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: Having ttruble with actions and buttons

2005-06-12 Thread Paul Goepfert
I am still new too struts so I don't understand why I would need to 
incluide forwards with names of success and failure in my 
struts-config.  Those forward names just look like their just general 
forward names that have no real effect on where the page goes.  Am I 
wrong in my thinking?


-Paul
Martin Gainty wrote:


Paul-
you need forwards defined for both success and failure name identified 
such as what you see in the struts doc
http://struts.apache.org/userGuide/building_controller.html e.g. 
struts-config.xml



   
   

HTH,
Martin-

- Original Message - From: "Paul Goepfert" 
<[EMAIL PROTECTED]>

To: 
Sent: Sunday, June 12, 2005 9:37 PM
Subject: Having ttruble with actions and buttons


Ok, here is the problem.  When I load up my web app the page loads 
fine. When I try to advance to another web page in my web app all I 
get is a blank screen.  For every page I have a form.java and an 
action.java file so I can move through the web app.  Here is part of 
my struts-config file that handles the actions.



  
  
  


In the form.java files I have getters and setters for the information 
I pass through the address bar.  In the action.java files I  have 
method calls to my logic for the program as well as forwards for the 
next page I wannt to go to.


If anyone can help me out that would be great.  If more information 
is needed let me know.


-Paul

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



Having ttruble with actions and buttons

2005-06-12 Thread Paul Goepfert
Ok, here is the problem.  When I load up my web app the page loads 
fine.  When I try to advance to another web page in my web app all I get 
is a blank screen.  For every page I have a form.java and an action.java 
file so I can move through the web app.  Here is part of my 
struts-config file that handles the actions.



  
  
  


In the form.java files I have getters and setters for the information I 
pass through the address bar.  In the action.java files I  have method 
calls to my logic for the program as well as forwards for the next page 
I wannt to go to.


If anyone can help me out that would be great.  If more information is 
needed let me know.


-Paul

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



Question about property files

2005-06-07 Thread Paul Goepfert
Just  a quick question, I have written a message resource foor part of 
my application.  I  have added the message-resource to my struts 
configuration.  However when I run my web app the properties file is not 
loaded.  I  know its the location.  Here is my  question, where in the 
web app directory structure do I place the propperties file?  I am 
asking on this list because it iis an entry in the struuts-config file.


-Paul

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



Having problems moving between pages with struts

2005-06-02 Thread Paul Goepfert
Here it is,  I am developing a small program  that utilizes Struts, Java 
and Apache Velocity Templates.  I amm trying to move from one page to 
another via struts.  Every time I try to move to another page I get a 
404 Error in Tomcat.  Here is my struts-conf.xml file as well as my 
web.xml file.  Could someone please tell me what is wrng with it.



   
   
   
   
   
   
   
   
   



   Personal Information
   
   action
 
org.apache.struts.action.ActionServlet

   
   config
   /WEB-INF/conf/struts-conf.xml
   
   2
   
   
   velocity
   
org.apache.velocity.tools.view.servlet.VelocityViewServlet

   10
   
   
   velocity
   *.vm
   
   action
   *.do
   


The servlet-class for "action" is not the same class for where my 
servlet is located.  Anonther thing that I don't understand is the *.do 
url-mapping If anyone can explain that to me that would be great.


Thanks

Paul

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