Re: ActionForward and input form

2006-04-29 Thread sudip shrestha
Is there some sort of setting that I am missing here? 
I would appreciate any kind of help.



--- Pat Slater [EMAIL PROTECTED] wrote:

 I have an method in a class that extends
 DispatchAction that throws Exception such as:
 public ActionForward saveMethod(ActionMapping
 mapping, ActionForm form, 
 HttpServletRequest request,
 HttpServletResponse response) throws Exception 
 {
 //..
   try {
   myWork = saveMyWork(); //This throws a
 DateFieldException
   } catch(DateFieldException e) {
   ActionMessages errors = new
 ActionMessages();
   ActionMessage error = new ActionMessage(
 errors.detail,e.getMessage() );
   errors.add(
 ActionMessages.GLOBAL_MESSAGE,error );
   saveErrors( request,errors );
   //return new ActionForward(
 mapping.getInput() );
   return mapping.findForward( failureDate
 );
   }
 //
 }
 This method is invoked on a form post of a html-form
 (input form).
 Here everything is working as expected except that
 when the exception is thrown it takes me back to the
 original input form, but the input values are not
 populated in the html-form anymore.  All the text
 fields are blank...  Is this something that has to
 do something with returning ActionForward  I
 obviously want those html-form fields to stay
 populated on the event of the exception, so that the
 user does not have to reenter all the fields except
 the field with the problem.
 Any help is highly appreciated.
 
   
 -
 Yahoo! Messenger with Voice. Make PC-to-Phone Calls
 to the US (and 30+ countries) for 2¢/min or less.


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: ActionForward and input form

2006-04-29 Thread sudip shrestha
Can you post your struts-config file here as well

--- sudip shrestha [EMAIL PROTECTED] wrote:

 Is there some sort of setting that I am missing
 here? 
 I would appreciate any kind of help.
 
 
 
 --- Pat Slater [EMAIL PROTECTED] wrote:
 
  I have an method in a class that extends
  DispatchAction that throws Exception such as:
  public ActionForward saveMethod(ActionMapping
  mapping, ActionForm form, 
  HttpServletRequest request,
  HttpServletResponse response) throws Exception 
  {
  //..
try {
myWork = saveMyWork(); //This throws a
  DateFieldException
} catch(DateFieldException e) {
ActionMessages errors = new
  ActionMessages();
ActionMessage error = new ActionMessage(
  errors.detail,e.getMessage() );
errors.add(
  ActionMessages.GLOBAL_MESSAGE,error );
saveErrors( request,errors );
//return new ActionForward(
  mapping.getInput() );
return mapping.findForward(
 failureDate
  );
}
  //
  }
  This method is invoked on a form post of a
 html-form
  (input form).
  Here everything is working as expected except that
  when the exception is thrown it takes me back to
 the
  original input form, but the input values are not
  populated in the html-form anymore.  All the text
  fields are blank...  Is this something that has to
  do something with returning ActionForward  I
  obviously want those html-form fields to stay
  populated on the event of the exception, so that
 the
  user does not have to reenter all the fields
 except
  the field with the problem.
  Any help is highly appreciated.
  
  
  -
  Yahoo! Messenger with Voice. Make PC-to-Phone
 Calls
  to the US (and 30+ countries) for 2¢/min or less.
 
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam
 protection around 
 http://mail.yahoo.com 
 

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


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



struts upload with jakarta-commons

2005-11-09 Thread sudip shrestha
Doing ftp file uploads in a struts webapp with jakarta-commons-net...did
bulk of google searchs...they all seem to go towards use of an applet
If anybody has any other ideas, I would be glad to hear.


Can one Action Method POST to another?

2005-11-09 Thread sudip shrestha
I have situation here where one action method need to do a POST to another
method of a DispatchAction implementing class. I need to know if this is
possible.
I have a struts webapp that uploads file to a ftp web server and so one of
the POST variables is a Struts FormFile object. If it were just string
parameters, I could do away with a GET.
The idea here is to display a Please Wait type of intermediate page before
the first action forwards with all the POST variables to a second action
method
Thanks for any inputs


application context access for Daemon Thread

2005-11-07 Thread sudip shrestha
I have a struts app that uses a Daemon thread (implements TimerTask) to run
at a periodic interval to do some background work. I am wondering if it is
possible to access application context from that daemon as I don't have
access to request/session variable from that daemon.
Also, is it possible to schedule a class that implements Runnable to start
executing the Run() from a specified Timestamp just like the TimerTask lets
you do it?
Thanks for any suggestions...


struts-action-intermediate page

2005-11-03 Thread sudip shrestha
Is it possible to display an intermediate page while struts action is doing
work...e.g. uploading a large file to a ftp serverand at the end of the
action will show the verfication/success page as usual.


struts download action

2005-11-03 Thread sudip shrestha
I have a struts action that downloads binary files from the database: e.g.:
/actions/download.do?fileId=xxx, etc
So, whenever users download any type of file with any id, the name of the
file displayed on any browser is download.do,
is it possible to set something in the response, so that I can supply the
name of the file which the browser displays to the user so that it displays
such as xxx.pdf instead of download.do.


Re: struts-action-intermediate page

2005-11-03 Thread sudip shrestha
I use struts dispatch actionwonder if this 'parameter' parameter will
affect my method 'parameter'

On 11/3/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 sudip shrestha [EMAIL PROTECTED] wrote on 11/03/2005 09:49:18 AM:

  Is it possible to display an intermediate page while struts action is
 doing
  work...e.g. uploading a large file to a ftp serverand at the end of
 the
  action will show the verfication/success page as usual.
 
  --

 Here you go:
 http://wiki.apache.org/struts/StrutsPleaseWait

 Geeta




struts plugin and destroy()

2005-10-17 Thread sudip shrestha
I have a struts plugin that works wellbut I realized that it was not
executing the destroy() method when the tomcat-server was shutdown. I have a
timer that needs to run timertask at a certain interval and have implemented
timer.cancel() method inside the destroy() methodBut there seems no sign
of this method being executed and the timertask keeps continuing even after
the tomcat was shutdown...Any suggestions?


technique to show a preview of the image

2005-05-31 Thread sudip shrestha
Any suggestions on showing a preview of the image stored in the database?
I found one which is: storing the file in a temporary folder and
display from there...

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



content management tool

2005-04-18 Thread sudip shrestha
Just curious if there are any struts based content managment tools out there!

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



Re: ssl-forwarding filter not working in IE 6

2005-04-17 Thread sudip shrestha
Actually, I fixed the code by adding encodeRedirectURL method. 
Strange thing is Firefox does not seem to care about proper url
encoding, where as IE does.

On 4/15/05, Sng Wee Jim [EMAIL PROTECTED] wrote:
 
 Try setting the following 2 response header
 
response.setHeader(Pragma, public);
response.setHeader(Cache-Control, max-age=0);
 
 - Jim
 
 -Original Message-
 From: sudip shrestha [mailto:[EMAIL PROTECTED]
 Sent: Friday, April 15, 2005 9:54 PM
 To: Struts Users Mailing List; Tomcat Users List
 Subject: ssl-forwarding filter not working in IE 6
 
 Hi : I have following code for automatic ssl-forwarding filter:
 
 public void doFilter(ServletRequest servletrequest, ServletResponse
 servletresponse, FilterChain filterchain)
throws IOException, ServletException
{
String s = servletrequest.getScheme();
if( !s.equalsIgnoreCase(http) )
{
//System.out.println( Normal filter Operation );
filterchain.doFilter(servletrequest, servletresponse);
}
else
{
HttpServletResponse response =
 (HttpServletResponse)servletresponse;
HttpServletRequest request =
 (HttpServletRequest)servletrequest;
 
//System.out.println( currPort: +request.getServerPort()
 );
String url = https://; + request.getServerName();
//System.out.println( currUrl: +url );
url = url + : + PORT;
//System.out.println( currUrl: +url );
url = url + request.getRequestURI();
//System.out.println( currUrl: +url );
String queryStr = request.getQueryString();
if( queryStr!=null )
url = url + ? + queryStr;
//System.out.println( currUrl: +url );
response.sendRedirect(url);
return;
}
}
 
 This works perfectly in Firefox.  However, IE just sits there till it
 throws me a page cannot be displayed.  If I directly type secure
 url, e.g., https://domain.com/siteAdd, it works in IE as well, but IE
 just cannot seem to forward it to the secure url from the plain url.
 Any suggestions?
 
 
 The information in this email is confidential and is intended solely
 for the addressee(s).
 Access to this email by anyone else is unauthorized. If you are not
 an intended recipient, please notify the sender of this email
 immediately. You should not copy, use or disseminate the
 information contained in the email.
 Any views expressed in this message are those of the individual
 sender, except where the sender specifically states them to be
 the views of Capco.
 
 http://www.capco.com/
 
 
 
 -
 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]



ssl-forwarding filter not working in IE 6

2005-04-15 Thread sudip shrestha
Hi : I have following code for automatic ssl-forwarding filter:

public void doFilter(ServletRequest servletrequest, ServletResponse
servletresponse, FilterChain filterchain)
throws IOException, ServletException
{
String s = servletrequest.getScheme();
if( !s.equalsIgnoreCase(http) )
{
//System.out.println( Normal filter Operation );
filterchain.doFilter(servletrequest, servletresponse);
}
else
{
HttpServletResponse response = (HttpServletResponse)servletresponse;
HttpServletRequest request = (HttpServletRequest)servletrequest;

//System.out.println( currPort: +request.getServerPort() );
String url = https://; + request.getServerName();
//System.out.println( currUrl: +url );
url = url + : + PORT;
//System.out.println( currUrl: +url );
url = url + request.getRequestURI();
//System.out.println( currUrl: +url );
String queryStr = request.getQueryString();
if( queryStr!=null )
url = url + ? + queryStr;
//System.out.println( currUrl: +url );
response.sendRedirect(url);
return;
}
}

This works perfectly in Firefox.  However, IE just sits there till it
throws me a page cannot be displayed.  If I directly type secure
url, e.g., https://domain.com/siteAdd, it works in IE as well, but IE
just cannot seem to forward it to the secure url from the plain url.
Any suggestions?

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



Re: session expiration issue and tiles

2005-04-12 Thread sudip shrestha
I am aware of all these things, but I cannot change my design at this
point, and today, I found out that this is some sort of bug in
internet explorer which does not do redirection properly and instead
displays blank page, where as Firefox does it without any problems.

On Apr 11, 2005 12:53 PM, Dave Newton [EMAIL PROTECTED] wrote:
 sudip shrestha wrote:
 
 I can understand presenting different menu options based on user
 privileges and having the same layout pages.  But my concern is there
 may be some pages which a user with less privileges may not be allowed
 to see at all, and what if he finds the url of that page and types the
 url in the browser and if that particular page does not have the
 authority-check not built into it, that user may be able to do stuff
 on the page..I hope you know what I am saying.
 
 
 The JSPs shouldn't be directly accessible anyway--if they're under
 WEB-INF then they cannot be directly accessed.
 
 Authentication would be handled either in a) a filter, b) an Action
 super-class, c) a custom RequestProcessor, or d) somewhere else.
 
 Personally, I don't believe _any_ authentication belongs in the view,
 but I'm obsessive.
 
 If an action is protected by one of the mechanisms above (or something
 functionally similar) and the JSPs are not directly accessible, then
 you don't need to worry about it at all on the presentation side.
 
 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: session expiration issue and tiles

2005-04-11 Thread sudip shrestha
Dave:
I can understand presenting different menu options based on user
privileges and having the same layout pages.  But my concern is there
may be some pages which a user with less privileges may not be allowed
to see at all, and what if he finds the url of that page and types the
url in the browser and if that particular page does not have the
authority-check not built into it, that user may be able to do stuff
on the page..I hope you know what I am saying.

On Apr 8, 2005 3:56 PM, Dave Newton [EMAIL PROTECTED] wrote:
 sudip shrestha wrote:
 
 I have user types with varying level of privileges and only a defined
 user type can access a particular page.  I thought of using filter for
 this purpose, but not sure how to designate which layout*.jsp (have
 created multiple layout.jsp pages for varying user types: e.g. admin
 can access layout1.jsp, user can access layout2.jsp) can be accessed
 by which user type.
 
 I'm not sure if we're addressing the same problems, or if my solution is
 a good one, but I have tiles:insert tags that insert menuing sub-tiles
 wrapped by an authorization level check, so depending on their auth
 level they get a different menu tile inserted.
 
 So the overall layout is the same for all user types, but different user
 authorization levels have different subtiles inserted. This method could
 be extended to cover any aspect of the layout: in my case it's a single
 row of menu options underneath the page's logo header.
 
 I imagine you could also create the name of the tile to be inserted
 on-the-fly using EL, but I didn't do that. Don't know why not; that
 seems cleaner, but I'm tired.
 
 Dave
 


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



session expiration issue and tiles

2005-04-08 Thread sudip shrestha
Using: Tomcat 5.5.7, Sun JDK 1.5,  Struts 1.2.4
--
I have few layout.jsp templates  where I have following chuck of code
which should redirect the browser to login page if session expires:
%   String loginCheck = notLoggedIn;
if( session.getAttribute( session_unique_id )!=null )
{
loginCheck = (String)session.getAttribute( session_unique_id 
);
}
if( !loginCheck.equals(admin0) )
{
%
logic:redirect forward=loginPage/
%   }
%

But when session expires, or when somebody who is not 'admin0' tries
to access the page, they get a blank page instead of getting
redirection.  I have tried using jsp:forward directive as well, but
the result is same.
If anybody has any suggestion on this, please let me know.

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



Re: session expiration issue and tiles

2005-04-08 Thread sudip shrestha
Dave:
I have user types with varying level of privileges and only a defined
user type can access a particular page.  I thought of using filter for
this purpose, but not sure how to designate which layout*.jsp (have
created multiple layout.jsp pages for varying user types: e.g. admin
can access layout1.jsp, user can access layout2.jsp) can be accessed
by which user type.  I could not use ldaprealm as system
administrators disagreed to storing password in server.xml file (which
is needed to read group membership)(I could have used container
managed security), so I am using tiles-layout page for the
verification.  This auth piece is at the top of the page,  so I don't
see the page already outputting to the HTTP connection before this
script executes.

On Apr 8, 2005 11:55 AM, Dave Newton [EMAIL PROTECTED] wrote:
 sudip shrestha wrote:
 
 --
 I have few layout.jsp templates  where I have following chuck of code
 which should redirect the browser to login page if session expires:
 %   String loginCheck = notLoggedIn;
if( session.getAttribute( session_unique_id )!=null )
{
loginCheck = (String)session.getAttribute( 
  session_unique_id );
}
if( !loginCheck.equals(admin0) )
{
 %
logic:redirect forward=loginPage/
 %   }
 %
 
 But when session expires, or when somebody who is not 'admin0' tries
 to access the page, they get a blank page instead of getting
 redirection.  I have tried using jsp:forward directive as well, but
 the result is same.
 If anybody has any suggestion on this, please let me know.
 
 
 Put this logic somewhere else like a filter or request processor.
 
 Not knowing the full layout of your tiles I'd say that you've probably
 already output to the HTTP connection, which means you can't redirect
 anymore. Just a guess. In any case this is handled _far_ better some
 place other than the presentation layer, especially if you have the same
 code in more than one place--sketchy.
 
 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: Hibernate Problem

2005-03-24 Thread sudip shrestha
I changed the dialect to DB2400 from DB2, and it solved the problem.


On Thu, 24 Mar 2005 13:36:50 -0600, sudip shrestha [EMAIL PROTECTED] wrote:
 Working on: Fedora Core2, Sun jdk 1.5, Tomcat 5.5.7, Hibernate 2.1.6, 
 AS/400-DB2
 Take a look at the following two Queries:
 #Hibernate generated query with Session.createQuery on SYS_CAT table:
 select * from (
  select rownumber() over() as row_, syscat0_.SYS_CAT_ID as SYS_CAT_ID
 from SYS_CAT syscat0_
  ) as temp_ where row_ = 10
 
 #The problem with this is AS/400-DB2 has a function called
 rrn(table_name) to fetch the row number, so when I replaced
 rownumber() over() with rrn(), it worked without any problems
 which is given below:
 
 select * from (
 select rrn(syscat0_) as row_, syscat0_.SYS_CAT_ID as SYS_CAT_ID from
 SYS_CAT syscat0_
 ) as temp_ where row_=10
 
 Does this mean that I will not be able to use Criteria Queries with
 Hibernate and wiill have to fall back on jdbc api to be able to
 retrieve desired number of rows of records at a time?  If anybody has
 experiece with this sort of stuffs,  please let me know!


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



Hibernate Problem

2005-03-24 Thread sudip shrestha
Working on: Fedora Core2, Sun jdk 1.5, Tomcat 5.5.7, Hibernate 2.1.6, AS/400-DB2
Take a look at the following two Queries:
#Hibernate generated query with Session.createQuery on SYS_CAT table:
select * from ( 
 select rownumber() over() as row_, syscat0_.SYS_CAT_ID as SYS_CAT_ID
from SYS_CAT syscat0_
 ) as temp_ where row_ = 10

#The problem with this is AS/400-DB2 has a function called
rrn(table_name) to fetch the row number, so when I replaced
rownumber() over() with rrn(), it worked without any problems
which is given below:

select * from (
select rrn(syscat0_) as row_, syscat0_.SYS_CAT_ID as SYS_CAT_ID from
SYS_CAT syscat0_
) as temp_ where row_=10

Does this mean that I will not be able to use Criteria Queries with
Hibernate and wiill have to fall back on jdbc api to be able to
retrieve desired number of rows of records at a time?  If anybody has
experiece with this sort of stuffs,  please let me know!

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



Re: forward

2005-03-16 Thread sudip shrestha
The ActionRedirect Class works great..Except one minor modification
has to be made under function public void addParameter(String
fieldName, Object valueObj):
instead of value = ResponseUtils.encodeURL(value);
use the following: value = TagUtils.getInstance().encodeURL(value);
First of all ResponseUtils does not have any such method as
encodeURL().  It is RequestUtils that has this method which is
deprecated after Struts 1.2.


On Mon, 14 Mar 2005 10:07:13 -0600, Hubert Rabago [EMAIL PROTECTED] wrote:
 You can create a new ActionForward object, copy the data from the
 original forward, and modify the path of the new object.
 A quick way would be to add the ActionRedirect class to your code and use 
 that:
 http://svn.apache.org/viewcvs.cgi/struts/core/trunk/src/share/org/apache/struts/action/ActionRedirect.java?rev=153901view=markup
 Usage examples are given in the javadoc.
 
 Hubert
 
 On Mon, 14 Mar 2005 08:17:02 -0600, sudip shrestha [EMAIL PROTECTED] wrote:
  I have certain situations when I have to forward the web page upon
  success to a certaion action or to a page with url such that it has a
  query string with it: e.g.:
  /actions/myActionxx.do?wId=123 or /pages/myPagexx.do?wId=123
 
  Now, I can't provide the query strings with ids in struts-config.xml
  file as the ids change depending upon the situation. So was wondering
  if there was any other way around to it?
 
  -
  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]



forward

2005-03-14 Thread sudip shrestha
I have certain situations when I have to forward the web page upon
success to a certaion action or to a page with url such that it has a
query string with it: e.g.:
/actions/myActionxx.do?wId=123 or /pages/myPagexx.do?wId=123

Now, I can't provide the query strings with ids in struts-config.xml
file as the ids change depending upon the situation. So was wondering
if there was any other way around to it?

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



PreparedStatements

2005-01-31 Thread sudip shrestha
Using JDBC- JTOpen 4.6 for AS/400 DB2
I have a PreparedStatement that inserts 25 values into a table with 25
attributes...
When I supply  23 or less attributes with values, the insert operation
works normally.
However, if I supply 24 or 25 attributes it throws an exception: 
java.sql.SQLException: [SQL0804] SQLDA not valid.

There seems to be nothing wrong the the database/table/metadata, I can
run insert/update/delete operations normally with direct sql.  It is
the PreparedStatements with JDBC that I am having problems with.
I was wondering if there was limitation on number of parameters that
you can supply with PreparedStatements??

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



Re: PreparedStatements

2005-01-31 Thread sudip shrestha
It seems that it is a bug with OS/400 R 5.1.
It has been documented before: 
http://www-124.ibm.com/developerworks/bugs/?func=detailbugbug_id=3160group_id=29


On Mon, 31 Jan 2005 12:48:55 -0600, sudip shrestha [EMAIL PROTECTED] wrote:
 Using JDBC- JTOpen 4.6 for AS/400 DB2
 I have a PreparedStatement that inserts 25 values into a table with 25
 attributes...
 When I supply  23 or less attributes with values, the insert operation
 works normally.
 However, if I supply 24 or 25 attributes it throws an exception:
 java.sql.SQLException: [SQL0804] SQLDA not valid.
 
 There seems to be nothing wrong the the database/table/metadata, I can
 run insert/update/delete operations normally with direct sql.  It is
 the PreparedStatements with JDBC that I am having problems with.
 I was wondering if there was limitation on number of parameters that
 you can supply with PreparedStatements??


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



Re: [OT] Re: Using XML in struts

2005-01-14 Thread sudip shrestha
JDOM: http://www.jdom.org/.
If you are new to xml-java parsing, then this is the way to go.  When
I started learning about xml parsing with java a while ago, I
researched various methods and found that JDOM provides the easiest
route to get things done.  A quote from JDOM mission: It behaves like
Java, it uses Java collections, it is completely natural API for
current Java developers, and it provides a low-cost entry point for
using XML.


On Fri, 14 Jan 2005 10:34:58 -0500, Erik Weber [EMAIL PROTECTED] wrote:
 
 
 Joe Germuska wrote:
 
  At 8:42 AM -0500 1/14/05, Erik Weber wrote:
 
  If you are not familiar with a lot of XML-related APIs, the easiest
  approach is to use the SAX API, in my opinion*.
 
 
  You may be the first person I've ever encountered who finds SAX the
  easiest way to process XML!
 
 
 Heh. I guess it's because I've written so many SAX event handlers, I
 feel like I can do it in my sleep now. I probably wrote a few (surely
 inferior) versions of commons-digester in my time. :) In fact, when I
 first started doing Web-app programming, I wrote an entire Struts-like
 framework complete with XML-based validation, similar to commons
 validator (I knew what Struts was but didn't feel like learning it at
 the time), as well as app configuration. I started with DOM but ended up
 using SAX for all that as I recall. Lately I've been using pull parsers,
 which are more efficient, but I still think not as dumb as SAX (dumb ==
 good -- I like typing. Makes you feel like you're accomplishing
 something. Thinking hurts my noggin. :D ). Also, while I see your point
 that the overall concept of DOM might be more sensible in theory than
 that of SAX, I found that it's just easier to get going with the SAX API
 than with DOM or even JDOM. You can get something working with very few
 lines of code, and good examples are all over the Web. SAX can be a pain
 to debug though.
 
 I read this awesome book called Building Parsers in Java a couple
 years ago (best ASCII-art cover ever) that really inspired me and got me
 thinking along the right lines for using a model like SAX. It's kind of
 like, you have this robot, and you keep handing him parts. The robot is
 smart enough to know which parts to keep and which to ignore (pull is
 definitely a smarter model than this -- the robot would ask for the
 parts he wants -- but this is simpler). He keeps a collection of
 running objects -- objects that he has started assembling but hasn't
 yet finished. Managing the running objects is the only part that really
 involves any thought in coding. Assembly of an object normally starts
 when an opening element tag is encountered. Assembly continues as
 sub-elements and attributes are discovered. Once he has finished the
 object (usually when a matching closing element tag is encountered) the
 robot adds it to the final Collection, Map or complex Object to be
 returned. To me, it's kinda elegant. But the deeper the XML, the more
 difficult it becomes, because there are more running objects at any
 given time.
 
 But I appreciate your elaborating on commons digester. That's the one I
 was thinking of. I'll have to check that out. Also, I've never even
 looked at Spring. By the way, do you happen to know what type of parser
 either of those uses? Just curious.
 
 Thanks,
 Erik
 
 
 
  * There are higher level APIs that might suit you better, depending
  on what you are doing. Struts and Commons Validator use some sort of
  higher-level config library, if I'm not mistaken, that is designed
  for constructing objects/Maps out of config files, so you might have
  a look at the source code for one or both of those. I'm sure someone
  else could on the list could better inform you about this.
 
 
  This is commons-digester, and it does in fact make it extremely simple
  to read XML and produce objects from it, especially if you have the
  liberty of defining the XML syntax before you write the processing
  code.  Digester really helped me get my design oriented towards decent
  externalization of configuration elements.  I now prefer the Spring
  Framework's bean factory, because it standardizes what I normally use
  Digester for without needing to write even XML processing rules.
 
  Since I started using Digester (and then Spring), I have not had much
  cause to deal with XML in the DOM form directly, although I would
  think that for most newcomers, the tree model is more straightforward
  than SAX's event model.  If you do need to do something with DOM, it's
  probably worth checking out dom4j or JDOM, two apis that simplify the
  DOM and provide a more Java-like API.
 
  Joe
 
 
 -
 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]



submitting multiple option items to struts action

2004-12-14 Thread Sudip Shrestha
-I have an html:select element which has several option items.  
-This is kind of unusual situation where I have to select multiple
option items instead of only one and submit that array of option items
to the struts action.
-The select element contains a lot of option items so using check
boxes and multiboxes for this purpose does not seem like a good idea.
-Is there any other way to do this?

-- 
Thanx,
Sudip

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



global-forward

2004-10-27 Thread Sudip Shrestha
I am trying this simple struts application here, that uses following:
global-forwards
forward name=welcome path=/Welcome.do/
/global-forwards
and under action-mappings :
action  path=/Welcome  forward=/pages/Welcome.jsp/
However, I am getting following exceptions.I could not find
anything regarding this message in the archive.
Any help would be appreciated.  I am wondering if this is being caused
by tag libs...
---
javax.servlet.ServletException: Cannot create redirect URL:
java.net.MalformedURLException: Cannot retrieve ActionForward named
welcome

org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)

org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.index_jsp._jspService(index_jsp.java:70)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause
javax.servlet.jsp.JspException: Cannot create redirect URL:
java.net.MalformedURLException: Cannot retrieve ActionForward named
welcome
org.apache.struts.taglib.logic.RedirectTag.doEndTag(RedirectTag.java:298)
org.apache.jsp.index_jsp._jspx_meth_logic_redirect_0(index_jsp.java:87)
org.apache.jsp.index_jsp._jspService(index_jsp.java:59)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
---
Thanx,
Sudip

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