Re: ExceptionHandler not able to display error messages

2003-11-21 Thread Pratik Patel

I have written an ExceptionHandler that extends the struts exceptionHandler.

I would like it to print a stack trace. So, I have done the following:
have a look at this blog entry, and the ExceptionHandler and JSP page I 
use for displaying exception messages (and stacktraces)

http://www.jroller.com/page/prpatel/20031023#handling_the_three_kinds_of

HTH,
Pratik


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


Re: Populating the next Form

2003-11-11 Thread Pratik Patel

I have ActionA and FormA associated to screenA, similarly ActionB and FormB
associated to screenB. Upon click of a button on ScreenA, I need to
dispatch ScreenB with some values prefilled. I was wondering where should I
be writing the logic to populate the FormB for showing those values
prefilled on ScreenB.
You can do it in either place (ActionA or ActionB). As someone has 
suggested, perhaps you want to keep everything together in *B. This 
really depends on how you wish to organize your Struts application.

I like to keep things organized at a functional level, for example all 
actions to User objects (adding, updating, loading) are kept in one 
UserAction class. I then use MappingDispatchAction(*) to send a request 
to the appropriate UserAction method. This way, I can glance at the 
struts-config.xml and know where and what a specific action mapping is 
doing without having dig any deeper.

*MappingDispatchAction is new and is not in 1.1 but in the nightly builds.

cheers
Pratik


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


Re: new to struts

2003-11-11 Thread Pratik Patel

can any one point the basic document 
regarding Struts which has given small examples.
There's this amazing new search engine, called Google, which you can 
access at www.google.com. If you enter the words "Struts Tutorial" and 
click "Search" it will bring up a huge list of Struts related websites.

Seriously though, you can find a raft of Struts tutorials here
http://jakarta.apache.org/struts/resources/articles.html
cheers
Pratik


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


Re: Exception handling - please help!

2003-10-28 Thread Pratik Patel
=?iso-8859-1?B?QuVyZCBBcnZlIEV2amVu ?= wrote:
Hi,

I'm trying hard not to rip out hair from my scalp. I cannot get the exception handling in struts to work. What am I doing wrong? Please help me before I go insane...
You are actually handling the exception in your Action class. You have 
to pass the exception up the (method) stack if you want to use the 
Struts exception handler.

The action's method signature should be something like this:

public SearchTradesAction extends Action throws Exception

and you must remove the "catch" statements in the Action.

Also, you will likely need a custom exception handler to populate 
ActionError messages.

Have a look here for some tips for Exception handling with Struts:

http://www.jroller.com/page/prpatel/20031023

cheers
Pratik


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


Re: [POLL] ActionFrom vs DynaActionForm

2003-10-01 Thread Pratik Patel
+1 ActionForms
-1 Dyna*Forms
Brandon Goodin wrote:
#1

Reasons:
-Dynas massive struts configs are annoying and the runtime errors
bite.
-DynaForm time saving is insignificant (how long does it take for your
ide to generate getters/setters?).

more reasons:
- Easy to copy properties from ActionForm to domain object (using 
BeanUtils.copyProperties )
- code completion can be used with ActionForms

cheers,
Pratik


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


Re: Cannot create a DynaValidatorForm

2003-10-01 Thread Pratik Patel
In validation.xml I added the following :








First, don't put *anything* in the form when you submit it to see if the 
 "required" validator is working.

Second, remove the space here:
depends="required, integer">
i.e. make it:
depends="required,integer">
HTH,
Pratik


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


Re: How do I populate a DynaValidatorForm?

2003-09-26 Thread Pratik Patel
Fenderbosch, Eric wrote:

Where do you specify the
@struts.form-field (0..*)
tags so that XDoclet creates the form for you?
Right now, I have a hand coded form and XDoclet creates the  section of my 
struts-config for me, but I'm not creating the actual ActionForm subclass with XDoclet.
In my domain objects; here's the objects from a Struts app I'm currently 
working on:

Domain Object   XDoclet Generated ActionForm
UserUserForm
Forum   ForumForm
PostPostForm
Thread  ThreadForm
Sample domain object:

package org.sourceforge.jwebforum.model;
import java.util.Date;
/**
 * @struts.form include-all="true"
 * extends="org.sourceforge.jwebforum.webapp.form.BaseForm"
 */
public class User {
private String password;
private String email;
private Date signupdate;
private String firstname;
private String lastname;
private String username;
private long userid;
public User(String password, String email, java.sql.Timestamp 
signupdate, String firstname, String lastname, String username, long 
userid) {
this.password = password;
this.email = email;
this.signupdate = signupdate;
this.firstname = firstname;
this.lastname = lastname;
this.username = username;
this.userid = userid;
}

public User() {
}
/** Password of the user.
 * @struts.validator type="required" msgkey="errors.required"
 */
public String getPassword() {
return password;
}
...


I hope to have this Struts application uploaded to sourceforge within 
two weeks (with full source, of course). It's still undergoing some 
refactoring, but I can send you the current snapshot if you're interested.

cheers,
Pratik


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


Re: How do I populate a DynaValidatorForm?

2003-09-26 Thread Pratik Patel
"DynaActionForms are not a drop-in replacement for ActionForms. If you
need to access ActionForm properties in your Action, you will need to
use the map-style accessor, like myForm.get("name"). If you actively use
the ActionForm object in your Action, then you may want to use
conventional ActionForms instead."
Why aren't you just using ActionForms? To be honest, I never use 
DynaActionForms. Sure, there's an extra Java class that needs to be 
written, but I find it easier to write an ActionForm class than write 
out a XML descriptor for a DynaActionForm. Plus it's easier to unit test 
 a concrete class than one that assumes its properties at runtime. If 
you're too lazy (like me) to actually write the ActionForm class, just 
use XDoclet to generate one for you.

cheers,
Pratik


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


Re: Menu based on Tiles

2003-09-24 Thread Pratik Patel

I need to create a menu using tiles. The menu is a vertical menu, where the
categories list comes as bold, and the currently selected menu should be
expanded to show the submenus. The currently selected submenu's hyperlink
should be disabled, rest have to be enabled.
What is the best way to design such a tile? Are there any sample codes for
the same?
I don't think a menu would be dependant on Tiles per se. Sure, you could 
wire in a menu using a tile, but the menu code (jsp/javascript/html) 
would also work by itself outside of Tiles.

While you think about it, have a look at this:
http://raibledesigns.com/wiki/Wiki.jsp?page=StrutsMenu
cheers,
Pratik


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