Dynamic forms

2006-04-27 Thread Silvija Cardzic-Mrsa
Hi,

I want to make fully dynamic forms with Struts. The form fields will be 
generated out of datasources. Is this possible with Struts 
and what technics do you recommend ?

Thanks for your help

Greetings
Silvija

Re: [shale] Form token giving NPE

2006-04-27 Thread Richard Wallace

Gary VanMatre wrote:
From: Richard Wallace <[EMAIL PROTECTED]> 

I'm trying to use the token component on a form to ensure that a user 
doesn't submit the form more than once. Whenever I try and submit the 
form a second time, I get a NPE. I'm using it in Clay, if that makes 
any difference. The code is simply: 



   
   
   ...



I'm using the 1.0.3-SNAPSHOT jars from the maven-snapshot-repository, 
last updated on April 19th. Any ideas why I'm getting the below NPE? 




It's working with myfaces 1.1.1.  The exception points at the findComponent but I would have guessed that we are not populating one of the message component attributes.   


Try adding the showSummary attribute to the message component.
  
Gary

  
Sorry it's taken a while to get back to this, but it was suddenly 
decided to change the whole flow of the app I'm working on. 

I tried adding the showSummary="true" attribute and am getting the same 
exception.  Any other ideas?


Thanks,
Rich
Thanks, 
Rich 

java.lang.NullPointerException: expr 
at 
javax.faces.component.UIComponentBase.findComponent(UIComponentBase.java:210) 
at 
org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H 
tmlMessageRenderer.java:200) 
at 
org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H 
tmlMessageRenderer.java:214) 
at 
org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H 
tmlMessageRenderer.java:214) 
at 
org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H 
tmlMessageRenderer.java:214) 
at 
org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H 
tmlMessageRenderer.java:214) 
at 
org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H 
tmlMessageRenderer.java:214) 
at 
org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H 
tmlMessageRenderer.java:214) 
at 
org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H 
tmlMessageRenderer.java:214) 
at 
org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.getOutputLabelMap(Html 
MessageRenderer.java:184) 
at 
org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.findInputLabel(HtmlMes 
sageRenderer.java:128) 
at 
org.apache.myfaces.renderkit.html.ext.HtmlMessagesRenderer.getSummary(HtmlMessag 
esRenderer.java:54) 
at 
org.apache.myfaces.renderkit.html.HtmlMessageRendererBase.renderSingleFacesMessa 
ge(HtmlMessageRendererBase.java:101) 
at 
org.apache.myfaces.renderkit.html.HtmlMessagesRendererBase.renderList(HtmlMessag 
esRendererBase.java:94) 
at 
org.apache.myfaces.renderkit.html.HtmlMessagesRendererBase.renderMessages(HtmlMe 
ssagesRendererBase.java:75) 
at 
org.apache.myfaces.renderkit.html.ext.HtmlMessagesRenderer.encodeEnd(HtmlMessage 
sRenderer.java:42) 
at 
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:331) 
at 
org.apache.shale.clay.component.Clay.recursiveRenderChildren(Clay.java:379) 



- 
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: Accessing Validation Errors in an Action

2006-04-27 Thread Asad Habib
Hello Rick. Great! Thank you for the URL. This site has a wealth of 
information on it!


- Asad


On Thu, 27 Apr 2006, Rick Reumann wrote:


Asad Habib wrote:
How do I access errors that the Validator places in the ActionErrors object 
instance within a Struts action? I need to do this in my action code so I 
can throw the appropriate kind of exception. Thanks.


I show this very thing at the end of this article:

http://www.learntechnology.net/validate-manually.do

--
Rick


-
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: [shale] Form token giving NPE

2006-04-27 Thread Richard Wallace

Gary VanMatre wrote:
From: Richard Wallace <[EMAIL PROTECTED]> 

I'm trying to use the token component on a form to ensure that a user 
doesn't submit the form more than once. Whenever I try and submit the 
form a second time, I get a NPE. I'm using it in Clay, if that makes 
any difference. The code is simply: 



   
   
   ...



I'm using the 1.0.3-SNAPSHOT jars from the maven-snapshot-repository, 
last updated on April 19th. Any ideas why I'm getting the below NPE? 




It's working with myfaces 1.1.1.  The exception points at the findComponent but I would have guessed that we are not populating one of the message component attributes.   


Try adding the showSummary attribute to the message component.
  
Gary

  
Ok, I created a small test app to see how the tokens would behave in a 
much simpler usage, and it works perfectly, both with plain old JSP and 
in Clay.  Guess I'll have to crank up the logging and try and sort 
through and see what exactly is going on.  I'll let you know if I find 
anything interesting.


Rich
Thanks, 
Rich 

java.lang.NullPointerException: expr 
at 
javax.faces.component.UIComponentBase.findComponent(UIComponentBase.java:210) 
at 
org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H 
tmlMessageRenderer.java:200) 
at 
org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H 
tmlMessageRenderer.java:214) 
at 
org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H 
tmlMessageRenderer.java:214) 
at 
org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H 
tmlMessageRenderer.java:214) 
at 
org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H 
tmlMessageRenderer.java:214) 
at 
org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H 
tmlMessageRenderer.java:214) 
at 
org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H 
tmlMessageRenderer.java:214) 
at 
org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(H 
tmlMessageRenderer.java:214) 
at 
org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.getOutputLabelMap(Html 
MessageRenderer.java:184) 
at 
org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.findInputLabel(HtmlMes 
sageRenderer.java:128) 
at 
org.apache.myfaces.renderkit.html.ext.HtmlMessagesRenderer.getSummary(HtmlMessag 
esRenderer.java:54) 
at 
org.apache.myfaces.renderkit.html.HtmlMessageRendererBase.renderSingleFacesMessa 
ge(HtmlMessageRendererBase.java:101) 
at 
org.apache.myfaces.renderkit.html.HtmlMessagesRendererBase.renderList(HtmlMessag 
esRendererBase.java:94) 
at 
org.apache.myfaces.renderkit.html.HtmlMessagesRendererBase.renderMessages(HtmlMe 
ssagesRendererBase.java:75) 
at 
org.apache.myfaces.renderkit.html.ext.HtmlMessagesRenderer.encodeEnd(HtmlMessage 
sRenderer.java:42) 
at 
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:331) 
at 
org.apache.shale.clay.component.Clay.recursiveRenderChildren(Clay.java:379) 



- 
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: Where dose JSP works in JSF request lifecycle?

2006-04-27 Thread 王曾wang_zeng

Thank you,Craig. What do you mean by setup action? Is that the kind of
action which  grabs  some data, do some encapsilation work, and stuff them
into JSP scopes.
You say we can archive the goal with shale as well as without  shale. I
remeber that between phases a Phase Event will be fired. When JSF skips
directly to the  Render  Response  phase,  can  I  use  phase  event
listener  to  grab  data  ? Is this approach what you think is painful?


--
Wang Zeng


RE: [Friday] struts and email

2006-04-27 Thread JEEVANATHAM P. /BPCRP/INFOTECH/VASHI
Hi Braun,

After upload file you have to save that in local or any where then attach.
I think you are not saving file.
Try this.

Thanks,
Jeeva.P

-Original Message-
From: Braun, James F [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 28, 2006 9:18 AM
To: Struts Users Mailing List
Subject: [Friday] struts and email

The goal is to upload a file and have it automatically emailed to a
recipient. 
 
In my .jsp page I have:
   
 
In my action form I have:
  private FormFile attachment;
 
My email code looks like this:
  void sendMessage()
  {
try // multipart/mixed
{
  // Get system properties
  Properties props = System.getProperties();
 
  // Setup mail server
  props.put("mail.smtp.host", DCL.emailHost);
 
  // Get session
  Session session = Session.getDefaultInstance(props, null);
 
  // Define message
  MimeMessage message = new MimeMessage(session);
 
  // from
  message.setFrom(new InternetAddress(from));
  // to
  message.addRecipient(Message.RecipientType.TO, new
InternetAddress(to));
  // subject
  message.setSubject(subject);
 
  // create multipart container
  Multipart multipart = new MimeMultipart();
 
  // message text
  BodyPart messageBP = new MimeBodyPart();
  messageBP.setText(text);
  multipart.addBodyPart(messageBP);
 
  // attachment
  if(attachment != null)
  {
try
{
  ByteArrayInputStream in = new
ByteArrayInputStream(attachment.getFileData(),0,attachment.getFileSize()
);
  MimeBodyPart mimein = new MimeBodyPart(in);
  mimein.setFileName(attachment.getFileName());
 
  //DataSource source = new MimePartDataSource(mimein);
 
  //MimeBodyPart attachBP = new MimeBodyPart();
  //attachBP.setDataHandler(new DataHandler(source));
 
  //attachBP.setFileName(attachment.getFileName());
  multipart.addBodyPart(mimein);
}
catch(MessagingException ex1)
{
}
catch(FileNotFoundException ex1)
{
}
catch(IOException ex1)
{
}
  }
 
  // assemble parts
  message.setContent(multipart);
 
  // Send message
  Transport.send(message);
}
catch(MessagingException ex)
{
}
  }
 
The problem is that the file is corrupted when it gets delivered. It
starts out as a 17k file and gets delivered as a 13k file.
 
Can anyone help point out where I'm going wrong and/or a better way to
do this? It's driving me nuts. (nothing to pack a lunch for I admit)
 
Thanks, J.



J. Braun
Polaroid Corp.
Waltham MA USA
+1 781.386.6871
+1 781.424.1159 mobile
[EMAIL PROTECTED]  
 
Excellence through execution.
 
 

-- 
This transmission is intended only for use by the addressee(s) named herein
and may contain information that is proprietary, confidential and/or legally
privileged. If you are not the intended recipient, you are hereby notified
that any disclosure, copying, distribution, or use of the information
contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If
you received this transmission in error, please immediately contact the
sender and destroy the material in its entirety, whether in electronic or
hard copy format. Thank you.



-- 
Greetings!

 


ICICI Infotech is now 3i Infotech.


The e-mail addresses of the company's employees have been changed to @3i-infotech.com. You are requested to take note of this new e-mail ID and 
make use of the same in future

 
"This e-mail message may contain confidential, proprietary or legally 
privileged information. It should not be used by anyone who is not the original 
intended recipient. If you have erroneously received this message, please 
delete it immediately and notify the sender. The recipient acknowledges that 3i 
Infotech or its subsidiaries and associated companies, (collectively "3i 
Infotech"), are unable to exercise control or ensure or guarantee the integrity 
of/over the contents of the information contained in e-mail transmissions and 
further acknowledges that any views expressed in this message are those of the 
individual sender and no binding nature of the message shall be implied or 
assumed unless the sender does so expressly with due authority of 3i Infotech. 
Before opening any attachments please check them for viruses and defects."



Re: StrutsTestCases

2006-04-27 Thread Chaitanya Parkhi
hi Ed,ya this is the same  problem i m trying to solve. i hav removed that
addtional slash before "D:" but still its not working, & also i i forgot to
mention in my first mail that i m getting follwing warnings on my consol
window:


log4j:WARN No appenders could be found for logger (
servletunit.struts.MockStrutsTestCase).

log4j:WARN Please initialize the log4j system properly.



On 4/27/06, Ed Griebel <[EMAIL PROTECTED]> wrote:
>
> There was a question about this a couple of days ago where web.xml was
> not being found. Also, it looks like you have a leading slash before
> the "D:" in  setConfigFile(), that could be the problem.
>
> HTH
> -ed
>
> On 4/27/06, Chaitanya Parkhi <[EMAIL PROTECTED]> wrote:
> > hi friends i m working on  Struts Test Cases ,i have written the
> following
> > code,for testing accurate user login from login page for my application
> i
> > hav included strutsTest-2.1.3.jar,junit.jar from JUNIT_HOME
> directory,when i
> > run the following code i m getting following failures:
> >
> > 1.junit.framework.AssertionFailedError: The /WEB-INF/web.xml was not
> found.
> > 2.junit.framework.AssertionFailedError: No tests found in
> > servletunit.struts.MockStrutsTestCase
> >
> > can anybody plz tell me whats a problem? is ther anything reqd to write
> in
> > web.xml for StrutstestCases?
> >
> >
> > import servletunit.struts.MockStrutsTestCase;
> >
> > public class TestLoginAction extends MockStrutsTestCase {
> >
> > public void setUp() throws Exception
> > {
> > super.setUp();
> > }
> >
> > public void tearDown() throws Exception
> > {
> > super.tearDown();
> > }
> >
> > public TestLoginAction(String testName)
> > {
> > super(testName);
> > }
> >
> >
> > public void testSuccessfulLogin() {
> >
> >
>
> >  
> > setConfigFile("/D:/Projects/Silk-Server/Phase2-RTQA1-Branch/SilkMobileServerWeb/WebRoot/WEB-INF/config/struts-
> > config.xml");
> >
> >
> >  setRequestPathInfo("/login");
> > addRequestParameter("username","cdpadmin");
> > addRequestParameter("password","cdp");
> >
> >
> > actionPerform();
> >
> > String[] actionErrors = {"username.required","password.required
> "};
> > verifyActionErrors(actionErrors);
> >
> >
> >  }
> >
> > public void testFailedLogin() {
> >
> > addRequestParameter("username","cdpadmin");
> > addRequestParameter("password","indiana");
> > setRequestPathInfo("/login");
> > actionPerform();
> >
> >
> > verifyTilesForward("success","success.tiles.def");
> >
> > verifyActionErrors(new String[] {"error.password.mismatch","
> > error.username.required","error.password.required"});
> > }
> >
> > }
> >
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


RE: [ANN] JAVAWUG BOF XVI Videos Available Now!

2006-04-27 Thread Rakesh.Bhat

Hi,

Thanks for sharing these links. They are really great.
 
Kind regards,
 
Rakesh Bhat 

-Original Message-
From: Peter Pilgrim [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 28, 2006 4:01 AM
To: [EMAIL PROTECTED]; Maven Users List; Struts Users Mailing
List; Struts Developers List
Subject: [ANN] JAVAWUG BOF XVI Videos Available Now!

Hi All

I am very proud to announce that two video presentations are now
downloadable 
from Google Video Beta sites. These presentations were recorded on our
sixteenth 
Java Web User Group meet-up that took place at Oracle's City of London
offices 
on Friday, 17th February 2006. In case you are wondering the videos are
free to 
view and/or download.

Here are the available videos and the slides:


Phil Zoio presents "Strecks: Java 5 extension framework for Struts"
http://video.google.com/videoplay?docid=9029377979060230803

Emmanuel Okyere presents "Spring into RIFE"
http://video.google.com/videoplay?docid=1163267747129711638


For more info visit www.javawug.com


-- 
Peter Pilgrim  ( Windows XP / Thunderbird 1.5 )
__ _ _ _
   / //__  // ___// ___/   +  Serverside Java
  / /___/ // /__ / /__ +  Struts
 / // ___// ___// ___/ +  Expresso Committer
  __/ // /__ / /__ / /__   +  Independent Contractor
 /___///////   +  Intrinsic Motivation
On Line Resume
||
\\===>  `` http://www.xenonsoft.demon.co.uk/no-it-striker.html ''


-
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: Beginner's question on Struts and JSP

2006-04-27 Thread Dharmendra Singh

It is little complex to extract data from database on to jsp page.I would
say that Go ahead step by step. I am sure will get touch with struts.
Step1.

You create ActionFrombean class (getter & setter methods).
2)
make a connection pool with database by using struts-config file(Datasource
elements);
3)declare bean class in form-bean section.
4) Create Action class & use connection pool in this class.Extract field
from database & put in setter methods & then put in ArrayList or Vector
whichever u think suitable.
& add in to session. return ActionForward.
5)Declare the Action class & formbean's logical name.
& forward name & jsp page
6) Create jsp page & use  tag &  tags.

If u go through this process , I am sure u will get ur desired results.If u
have any problem , feel free to contact.
09818760086


On 4/24/06, Vinit Sharma <[EMAIL PROTECTED]> wrote:


You are using Map-Backed action form. This link might solve your problem:


http://struts.apache.org/struts-action/userGuide/building_controller.html#map_action_form_classes

http://struts.apache.org/struts-doc-1.2.9/faqs/indexedprops.html

HTH,


On 4/22/06, Developer Developer <[EMAIL PROTECTED]> wrote:
>
> Harsh and Ted,
> Thanks for the information  Here is one more question. I am able to
create
> an ActionForm with a collection type attribute in it ( Vector) and also
> i could link it to the table in the JSP.  I am getting an error "No
getter
> method for property vSectors of bean sectorData". Do you know what i
must
> have done wrong ? the actionForm has getter and setter for a variable
> named  Vector vSectors in the actionform SectorData.
>
> Another question is- First time when the JSP comes up i want the
formbean
> to
> display values from the database. Where do i initialize the form bean to
> read data from database?
>
> Thanks !
>
>
>
>
> 
>
> 
>
> 
> property="vSectors" indexId="index">
>
> 
>
> 
> property='<%= "vSectors[" + index + "]" %>' />
>
> 
>
> 
>
> 
>
> 
>
>
>
>
> On 4/21/06, Chaudhary, Harsh <[EMAIL PROTECTED]> wrote:
> > Another resource I found to be very helpful is:
> > http://struts.apache.org/struts-action/userGuide/index.html
> >
> > Harsh.
> >
> > -Original Message-
> > From: Ted Husted [mailto: [EMAIL PROTECTED]
> > Sent: Friday, April 21, 2006 10:55 AM
> > To: Struts Users Mailing List
> > Subject: Re: Beginner's question on Struts and JSP
> >
> >
> > The best thing might be to start by going through the MailReader
> > application that is bundled with the distribution. It does things like
> > populate a table from a database, and covers several other use cases
> > you will run into.
> >
> > Also be sure to review the latest FAQs on the website, to be sure you
> > get started "on the right foot".
> >
> > * http://struts.apache.org/faqs.html
> >
> > HTH, Ted.
> >
> > On 4/21/06, Developer Developer <[EMAIL PROTECTED]> wrote:
> > > Hello,
> > >
> > > I need to  create a  Table  in JSP with values coming from the
> > database. I
> > > want to use struts frame work for this application.
> > >
> > > Here is my question
> > >
> > > How should I design a formbean and link it to the view (JSP) ?
Sample
> > view
> > > code would be very helpful.  I think I need to have a collection
type
> > in the
> > > form bean to store the values from the database and some how link to
> > the the
> > > table in the JSP ( but don;t know how to do it)
> > >
> > > 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]
> >
> >
>
>


--
Vinit Sharma
IBM




[Friday] struts and email

2006-04-27 Thread Braun, James F
The goal is to upload a file and have it automatically emailed to a
recipient. 
 
In my .jsp page I have:
   
 
In my action form I have:
  private FormFile attachment;
 
My email code looks like this:
  void sendMessage()
  {
try // multipart/mixed
{
  // Get system properties
  Properties props = System.getProperties();
 
  // Setup mail server
  props.put("mail.smtp.host", DCL.emailHost);
 
  // Get session
  Session session = Session.getDefaultInstance(props, null);
 
  // Define message
  MimeMessage message = new MimeMessage(session);
 
  // from
  message.setFrom(new InternetAddress(from));
  // to
  message.addRecipient(Message.RecipientType.TO, new
InternetAddress(to));
  // subject
  message.setSubject(subject);
 
  // create multipart container
  Multipart multipart = new MimeMultipart();
 
  // message text
  BodyPart messageBP = new MimeBodyPart();
  messageBP.setText(text);
  multipart.addBodyPart(messageBP);
 
  // attachment
  if(attachment != null)
  {
try
{
  ByteArrayInputStream in = new
ByteArrayInputStream(attachment.getFileData(),0,attachment.getFileSize()
);
  MimeBodyPart mimein = new MimeBodyPart(in);
  mimein.setFileName(attachment.getFileName());
 
  //DataSource source = new MimePartDataSource(mimein);
 
  //MimeBodyPart attachBP = new MimeBodyPart();
  //attachBP.setDataHandler(new DataHandler(source));
 
  //attachBP.setFileName(attachment.getFileName());
  multipart.addBodyPart(mimein);
}
catch(MessagingException ex1)
{
}
catch(FileNotFoundException ex1)
{
}
catch(IOException ex1)
{
}
  }
 
  // assemble parts
  message.setContent(multipart);
 
  // Send message
  Transport.send(message);
}
catch(MessagingException ex)
{
}
  }
 
The problem is that the file is corrupted when it gets delivered. It
starts out as a 17k file and gets delivered as a 13k file.
 
Can anyone help point out where I'm going wrong and/or a better way to
do this? It's driving me nuts. (nothing to pack a lunch for I admit)
 
Thanks, J.



J. Braun
Polaroid Corp.
Waltham MA USA
+1 781.386.6871
+1 781.424.1159 mobile
[EMAIL PROTECTED]  
 
Excellence through execution.
 
 

-- 
This transmission is intended only for use by the addressee(s) named herein and 
may contain information that is proprietary, confidential and/or legally 
privileged. If you are not the intended recipient, you are hereby notified that 
any disclosure, copying, distribution, or use of the information contained 
herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received 
this transmission in error, please immediately contact the sender and destroy 
the material in its entirety, whether in electronic or hard copy format. Thank 
you.




Re: Where dose JSP works in JSF request lifecycle?

2006-04-27 Thread Craig McClanahan
On 4/27/06, 王曾wang_zeng <[EMAIL PROTECTED]> wrote:
>
> In JSF, when a request arrives, it should go through 6 phases to process
> the
> request. The first stage is called Restore the View , and the last stage
> is
> called Render the Response. I wonder where JSP works in these 6
> phases.  If
> JSP only works in the last phase,


Which is, indeed, exactly how it works.

how can JSF restore the view first time
> the user view the page with no existing component tree in the session,
> because the information about the definition of the tree resides in the
> JSP
> by the form of JSF tags.  So I think maybe both the *Restore the View* and
> *Render the Response* need JSP to be involved.


You are correct.  There is special handling defined in the Restore View
phase.  If that phase discovers that there is no state to be restored
(either because this is an initial request for the welcome page, or because
this is a GET request for some other page accessed via a redirect or a
bookmark), then JSF will immediately forward to Render Response phase.

So, how do you make sure that the right dynamic data gets loaded so that the
page displays the right stuff?  That's where Shale comes in handy.  If your
backing bean implements the ViewController interface, then prerender() will
get called just before the JSP page is invoked.  This is the perfect place
to grab any data you need from your database to display the requested page.

You can do this without Shale, but there's somewhat more pain involved.
Better to have the framework tell you "Hey, I am about to render this page,
do you need to set up any state?".  In a Struts 1.x world, this corresponds
to the kind of stuff you might do in a setup action.

--
> Wang Zeng
>
>
Craig


Re: Accessing Validation Errors in an Action

2006-04-27 Thread Rick Reumann

Asad Habib wrote:
How do I access errors that the Validator places in the ActionErrors 
object instance within a Struts action? I need to do this in my action 
code so I can throw the appropriate kind of exception. Thanks.


I show this very thing at the end of this article:

http://www.learntechnology.net/validate-manually.do

--
Rick


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



Where dose JSP works in JSF request lifecycle?

2006-04-27 Thread 王曾wang_zeng

In JSF, when a request arrives, it should go through 6 phases to process the
request. The first stage is called Restore the View , and the last stage is
called Render the Response. I wonder where JSP works in these 6 phases.  If
JSP only works in the last phase, how can JSF restore the view first time
the user view the page with no existing component tree in the session,
because the information about the definition of the tree resides in the JSP
by the form of JSF tags.  So I think maybe both the *Restore the View* and
*Render the Response* need JSP to be involved.

--
Wang Zeng


Re: Accessing Validation Errors in an Action

2006-04-27 Thread Lixin Chu
if the validation is done at the server side (in your actionform), then you
can easily get the errors.

On 4/28/06, Asad Habib <[EMAIL PROTECTED]> wrote:
>
> How do I access errors that the Validator places in the ActionErrors
> object instance within a Struts action? I need to do this in my action
> code so I can throw the appropriate kind of exception. Thanks.
>
> - Asad
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Accessing Validation Errors in an Action

2006-04-27 Thread Asad Habib
How do I access errors that the Validator places in the ActionErrors 
object instance within a Struts action? I need to do this in my action 
code so I can throw the appropriate kind of exception. Thanks.


- Asad

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



[ANN] JAVAWUG BOF XVI Videos Available Now!

2006-04-27 Thread Peter Pilgrim

Hi All

I am very proud to announce that two video presentations are now downloadable 
from Google Video Beta sites. These presentations were recorded on our sixteenth 
Java Web User Group meet-up that took place at Oracle's City of London offices 
on Friday, 17th February 2006. In case you are wondering the videos are free to 
view and/or download.


Here are the available videos and the slides:


Phil Zoio presents "Strecks: Java 5 extension framework for Struts"
http://video.google.com/videoplay?docid=9029377979060230803

Emmanuel Okyere presents "Spring into RIFE"
http://video.google.com/videoplay?docid=1163267747129711638


For more info visit www.javawug.com


--
Peter Pilgrim  ( Windows XP / Thunderbird 1.5 )
   __ _ _ _
  / //__  // ___// ___/   +  Serverside Java
 / /___/ // /__ / /__ +  Struts
/ // ___// ___// ___/ +  Expresso Committer
 __/ // /__ / /__ / /__   +  Independent Contractor
/___///////   +  Intrinsic Motivation
On Line Resume
   ||
   \\===>  `` http://www.xenonsoft.demon.co.uk/no-it-striker.html ''


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



Re: validatewhen --- what's wrong?

2006-04-27 Thread Jakub Milkiewicz
Right
This anlr gramma is quite not intuitive ...

2006/4/27, Chaudhary, Harsh <[EMAIL PROTECTED]>:
>
> Try it like this.
> (*this* == 'password')
>
> -Original Message-
> From: Jakub Milkiewicz [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 27, 2006 12:34 PM
> To: Struts Users Mailing List
> Subject: Re: validatewhen --- what's wrong?
>
>
> Hi
> To tell you the truth i do not understand what you wanna do...
> Anyway your validwhen condition is always true!
> Note that you are comparing *this* - for property password,  with
> property
> password.
> It means something like 1==1.
>
>
>
> 2006/4/26, Zheng Wen Zhe <[EMAIL PROTECTED]>:
> >
> > Hey all,
> >
> > I wanna it say yes when a user type 'password' into this password
> field.
> >
> > But, it doesn't work that way. Validation always passes no matter what
> the
> > user has given into the password field.
> >
> > Pls, someone tell what wrong with it!!!
> >
> >
> >
> > Validation.xml
> >
> > 
> >
> > 
> >
> >  >
> >   "-//Apache Software Foundation//DTD Commons Validator Rules
> > Configuration 1.1.3//EN"
> >
> >
> "http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd";>
> >
> > 
> >
> >   
> >
> > 
> >
> >   
> >
> > 
> >
> >   
> >
> >depends="required,validwhen">
> >
> > 
> >
> > 
> >
> >   test
> >
> >   *this* ==
> password
> >
> > 
> >
> >
> >
> >   
> >
> > 
> >
> >   
> >
> >
> >
> > 
> >
> >
> >
> >
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


RE: validatewhen --- what's wrong?

2006-04-27 Thread Chaudhary, Harsh
Try it like this.
 (*this* == 'password')

-Original Message-
From: Jakub Milkiewicz [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 27, 2006 12:34 PM
To: Struts Users Mailing List
Subject: Re: validatewhen --- what's wrong?


Hi
To tell you the truth i do not understand what you wanna do...
Anyway your validwhen condition is always true!
Note that you are comparing *this* - for property password,  with
property
password.
It means something like 1==1.



2006/4/26, Zheng Wen Zhe <[EMAIL PROTECTED]>:
>
> Hey all,
>
> I wanna it say yes when a user type 'password' into this password
field.
>
> But, it doesn't work that way. Validation always passes no matter what
the
> user has given into the password field.
>
> Pls, someone tell what wrong with it!!!
>
>
>
> Validation.xml
>
> 
>
> 
>
> 
>   "-//Apache Software Foundation//DTD Commons Validator Rules
> Configuration 1.1.3//EN"
>
>
"http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd";>
>
> 
>
>   
>
> 
>
>   
>
> 
>
>   
>
>   
>
> 
>
> 
>
>   test
>
>   *this* ==
password
>
> 
>
>
>
>   
>
> 
>
>   
>
>
>
> 
>
>
>
>
>

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



RE: ActionMessages not working

2006-04-27 Thread fea jabi


Here is the solution for this

just make sure to add message="true" in the html:messages tag
i.e

IN jsp

 or just ${CrditRtMsg}




From: "fea jabi" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" 
To: user@struts.apache.org
Subject: ActionMessages not working
Date: Thu, 27 Apr 2006 13:57:46 -0400

in action I have

  ActionMessages messages = (ActionMessages)frm.validate( mapping, 
request );

   if ( messages != null && !messages.isEmpty() ) {
   saveMessages(request, messages);  * 
   return (mapping.findForward("validFailed"));
   }else {
   //No ActionMessages/Errors
   if(isTokenValid(request, true)) {
   //do calculate
   }
   }

IN jsp

  


When I debug I see the messages in the action. But the jsp doesn't display 
them?

Also, when changed the
saveMessages()   to saveErrors() in the action method above, can see the 
messages. everything works fine as expected.


why is this? what changes have to be made?

Thanks.

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



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



_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



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



ActionMessages not working

2006-04-27 Thread fea jabi

in action I have

  ActionMessages messages = (ActionMessages)frm.validate( mapping, 
request );

   if ( messages != null && !messages.isEmpty() ) {
   saveMessages(request, messages);  * 
   return (mapping.findForward("validFailed"));
   }else {
   //No ActionMessages/Errors
   if(isTokenValid(request, true)) {
   //do calculate
   }
   }

IN jsp

  


When I debug I see the messages in the action. But the jsp doesn't display 
them?

Also, when changed the
saveMessages()   to saveErrors() in the action method above, can see the 
messages. everything works fine as expected.


why is this? what changes have to be made?

Thanks.

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



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



Re: validatewhen --- what's wrong?

2006-04-27 Thread Jakub Milkiewicz
Hi
To tell you the truth i do not understand what you wanna do...
Anyway your validwhen condition is always true!
Note that you are comparing *this* - for property password,  with property
password.
It means something like 1==1.



2006/4/26, Zheng Wen Zhe <[EMAIL PROTECTED]>:
>
> Hey all,
>
> I wanna it say yes when a user type 'password' into this password field.
>
> But, it doesn't work that way. Validation always passes no matter what the
> user has given into the password field.
>
> Pls, someone tell what wrong with it!!!
>
>
>
> Validation.xml
>
> 
>
> 
>
> 
>   "-//Apache Software Foundation//DTD Commons Validator Rules
> Configuration 1.1.3//EN"
>
>   "http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd";>
>
> 
>
>   
>
> 
>
>   
>
> 
>
>   
>
>   
>
> 
>
> 
>
>   test
>
>   *this* == password
>
> 
>
>
>
>   
>
> 
>
>   
>
>
>
> 
>
>
>
>
>


Re: Problem with message and Expired session

2006-04-27 Thread Juergen Kopper

Hi,

Angel Navarro schrieb:

Hi,

when I say 'the system expired session' is that the user are a lot of time
without navigate and explorer expired session,
dou you understand me?

  
Yes I understand it and I think this makes the same as the invalidate(), 
this means it unbinds all Objects of a Session also the Locale-Object.


-> 
http://java.sun.com/j2ee/sdk_1.2.1/techdocs/api/javax/servlet/http/HttpSession.html


An approach for (Struts 1.1) to handle Session problems is:
   -use the saveToken() in a login action
   -all other actions need to use the isTokenValid() to check if the 
session is not expired

Thanks

  

Hope this can help you .

Juergen

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



Re: Problem with message and Expired session

2006-04-27 Thread Angel Navarro
Hi,

when I say 'the system expired session' is that the user are a lot of time
without navigate and explorer expired session,
dou you understand me?

Thanks


2006/4/27, Juergen Kopper <[EMAIL PROTECTED]>:
>
> Hi,
>
> Angel Navarro schrieb:
> >
> > My problem is the session expired because the system expired session.
> > I have not invalidate()..do you know?
> >
> I don't know. But perhaps you show some code (Action, jsp and
> struts-config), to get a better help for this problem.
>
> Juergen
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: StrutsTestCases

2006-04-27 Thread Ed Griebel
There was a question about this a couple of days ago where web.xml was
not being found. Also, it looks like you have a leading slash before
the "D:" in  setConfigFile(), that could be the problem.

HTH
-ed

On 4/27/06, Chaitanya Parkhi <[EMAIL PROTECTED]> wrote:
> hi friends i m working on  Struts Test Cases ,i have written the following
> code,for testing accurate user login from login page for my application i
> hav included strutsTest-2.1.3.jar,junit.jar from JUNIT_HOME directory,when i
> run the following code i m getting following failures:
>
> 1.junit.framework.AssertionFailedError: The /WEB-INF/web.xml was not found.
> 2.junit.framework.AssertionFailedError: No tests found in
> servletunit.struts.MockStrutsTestCase
>
> can anybody plz tell me whats a problem? is ther anything reqd to write in
> web.xml for StrutstestCases?
>
>
> import servletunit.struts.MockStrutsTestCase;
>
> public class TestLoginAction extends MockStrutsTestCase {
>
> public void setUp() throws Exception
> {
> super.setUp();
> }
>
> public void tearDown() throws Exception
> {
> super.tearDown();
> }
>
> public TestLoginAction(String testName)
> {
> super(testName);
> }
>
>
> public void testSuccessfulLogin() {
>
>
>  
> setConfigFile("/D:/Projects/Silk-Server/Phase2-RTQA1-Branch/SilkMobileServerWeb/WebRoot/WEB-INF/config/struts-
> config.xml");
>
>
>  setRequestPathInfo("/login");
> addRequestParameter("username","cdpadmin");
> addRequestParameter("password","cdp");
>
>
> actionPerform();
>
> String[] actionErrors = {"username.required","password.required"};
> verifyActionErrors(actionErrors);
>
>
>  }
>
> public void testFailedLogin() {
>
> addRequestParameter("username","cdpadmin");
> addRequestParameter("password","indiana");
> setRequestPathInfo("/login");
> actionPerform();
>
>
> verifyTilesForward("success","success.tiles.def");
>
> verifyActionErrors(new String[] {"error.password.mismatch","
> error.username.required","error.password.required"});
> }
>
> }
>
>

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



Re: Problem with message and Expired session

2006-04-27 Thread Juergen Kopper

Hi,

Angel Navarro schrieb:
 
My problem is the session expired because the system expired session.

I have not invalidate()..do you know?
 
I don't know. But perhaps you show some code (Action, jsp and 
struts-config), to get a better help for this problem.


Juergen

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



Re: multiple pattern mapping

2006-04-27 Thread Ted Husted
Sadly, multiple extension mappings is not supported by Action 1 (*).
"There can only be one".

The usual workaround is to use different "folders" to represent
different authentification types. So, you'd have to have something
like /auth/something.do versus /open/something.do.

For more complex authentification tasks, many people find
ServletFilter and Acergi useful.

* http://securityfilter.sourceforge.net/

* http://www.acegisecurity.org/

HTH, Ted.

(*) Albeit, multiple Action extensions is supported by WebWork2/Action2.

On 4/25/06, Mike Korcynski <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  I'm trying to use 2 different pattern mappings to the action servlet,
> and have one handle protected action and one handle public actions using
> security-constraints, the mappings look like this:
>
>   
> action
> *.auth
>   
>   
> action
> *.do
>   
>
>
> The problem is in my form.jsp I specify my action specifically as
> authorize.auth, and yet when the page renders the action is always
> changed back to authorize.do
>
> 
>
> 
>
> The action mappings in my struts-config is like this:
>
>  input="/form/login.jsp"
> name="authorizeForm"
> type="blah.action.AuthorizeAction"
> scope="request"
> validate="false">
> 
> 
> 
>
> Any idea what could be wrong?
>
> Thanks for your help,
> Mike
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
HTH, Ted.
** http://www.husted.com/ted/blog/

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



Re: How use AND,OR in logic struts tag lib

2006-04-27 Thread Angel Navarro
Thanks

2006/4/27, Vinit Sharma <[EMAIL PROTECTED]>:
>
> A very small article on JSTL for quick reference:
>
> http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPIntro7.html
>
>
> On 4/26/06, Rahul Akolkar <[EMAIL PROTECTED]> wrote:
> >
> > On 4/26/06, Angel Navarro <[EMAIL PROTECTED]> wrote:
> > > Hi,
> > >
> > > I need to translate:
> > >
> > > if ( a == 'option1'  || a == 'option2' )
> > >
> > 
> >
> > Use JSTL:
> >
> > 
> >   ...
> > 
> >
> > "and" is also available in EL similarly.
> >
> > -Rahul
> >
> >
> > > to struts code
> > > I don't know how put || or && in  > >
> > > Thanks
> > >
> > >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> Vinit Sharma
> IBM
>
>


Re: How use AND,OR in logic struts tag lib

2006-04-27 Thread Vinit Sharma
A very small article on JSTL for quick reference:

http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPIntro7.html


On 4/26/06, Rahul Akolkar <[EMAIL PROTECTED]> wrote:
>
> On 4/26/06, Angel Navarro <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I need to translate:
> >
> > if ( a == 'option1'  || a == 'option2' )
> >
> 
>
> Use JSTL:
>
> 
>   ...
> 
>
> "and" is also available in EL similarly.
>
> -Rahul
>
>
> > to struts code
> > I don't know how put || or && in  >
> > Thanks
> >
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
Vinit Sharma
IBM


Re: Problem with message and Expired session

2006-04-27 Thread Angel Navarro
Hi,

thanks for your comments.

My problem is the session expired because the system expired session.
I have not invalidate()..do you know?

Thanks


2006/4/26, Juergen Kopper <[EMAIL PROTECTED]>:
>
> Hi,
>
> Angel Navarro schrieb:
> > When user logon, I set the locale's user and all is ok.
> > But, the expired session, the page that say
> >
> If you use the invalidate() of the HttpSession, it will also remove the
> locale. But it's only an assumption, that this is your problem.
> > Would you like another logon.
> >
> > have not the correct language.
> >
> > Have anybody any solution?
> If you used the invalidate() try to use the removeAttribute instead.
> >
> > Thanks
> >
> Juergen
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


StrutsTestCases

2006-04-27 Thread Chaitanya Parkhi
hi friends i m working on  Struts Test Cases ,i have written the following
code,for testing accurate user login from login page for my application i
hav included strutsTest-2.1.3.jar,junit.jar from JUNIT_HOME directory,when i
run the following code i m getting following failures:

1.junit.framework.AssertionFailedError: The /WEB-INF/web.xml was not found.
2.junit.framework.AssertionFailedError: No tests found in
servletunit.struts.MockStrutsTestCase

can anybody plz tell me whats a problem? is ther anything reqd to write in
web.xml for StrutstestCases?


import servletunit.struts.MockStrutsTestCase;

public class TestLoginAction extends MockStrutsTestCase {

public void setUp() throws Exception
{
super.setUp();
}

public void tearDown() throws Exception
{
super.tearDown();
}

public TestLoginAction(String testName)
{
super(testName);
}


public void testSuccessfulLogin() {


 
setConfigFile("/D:/Projects/Silk-Server/Phase2-RTQA1-Branch/SilkMobileServerWeb/WebRoot/WEB-INF/config/struts-
config.xml");


 setRequestPathInfo("/login");
addRequestParameter("username","cdpadmin");
addRequestParameter("password","cdp");


actionPerform();

String[] actionErrors = {"username.required","password.required"};
verifyActionErrors(actionErrors);


 }

public void testFailedLogin() {

addRequestParameter("username","cdpadmin");
addRequestParameter("password","indiana");
setRequestPathInfo("/login");
actionPerform();


verifyTilesForward("success","success.tiles.def");

verifyActionErrors(new String[] {"error.password.mismatch","
error.username.required","error.password.required"});
}

}


Re: How to produce valid HTML output with the html:tags

2006-04-27 Thread Nikolaj Berntsen
Peter Neu wrote:

>Hello,
>
>in an effort to clean up my site I try to do everything by the W3C standard.
>
>I threw out all design tables and other useless crap but now one problem
>remains and it's related to Struts. All  tags generate a tag
>which is not closed. Like this: 
>
> 
>
>Because the tag is not closed the w3c validator says it's not valid. What
>can I do to make it valid?
>  
>
I believe the magic word is that you want to produce xhtml? a google for
that leads to this mail from the list:
   
http://mail-archives.apache.org/mod_mbox/struts-user/200403.mbox/[EMAIL 
PROTECTED]

which has the useful (?) snippet:

There are a couple of issues to look out for, such as with tiles, where 
you use the tag you mention. In your main pages, use 

Cheers,
/\/


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



How to produce valid HTML output with the html:tags

2006-04-27 Thread Peter Neu
Hello,

in an effort to clean up my site I try to do everything by the W3C standard.

I threw out all design tables and other useless crap but now one problem
remains and it's related to Struts. All  tags generate a tag
which is not closed. Like this: 

 

Because the tag is not closed the w3c validator says it's not valid. What
can I do to make it valid?

Cheers,
Pete





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