how to output html symbol to jsp page from user-defined taglib?

2004-02-07 Thread Ricky Lee
hi, thanks for reading..

i have a problem about output a html symbol from
taglib

if i in a jsp page, use the code below:

%
String abc=gt;;
out.println(abc);
%

it can show the symbol ;

if in my taglib class, i use code below:

pageContext.setAttribute(symbal, gt;);

and in the jsp page, i use code below to output the
page context attrubite.

c:out value=${symbal} /

it doesn't show me the  symbol, it still show me
gt;

please help methanks! 



__
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

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



converting a href with variable target into html:link

2004-01-13 Thread Ricky Purnomo
I am converting a pure JSP page into Struts, and am having problem
converting links which calls a javascript and has dynamically specified
target. The particular line is below:

a href=javascript:if (confirm('Do you want to delete this event?'))
location = 'delete.jsp?e=%= EventId %' class=eventheaderlinkDelete/a

My current converted line reads:

a href=javascript:if (confirm('Do you want to delete this event?'))
location = '/EventDelete.do?e=bean:write name=EventForm
property=eventId/' class=eventheaderlink

but I cannot find an equivalent using html:link, problem being I cannot
add the closing single quote back (or more generally stated, I cannot have
constant+variable+constant in the link). My attempt:

html:link href=javascript:if (confirm('Do you want to delete this
event?')) location = '/EventDelete.do paramId=e paramName=EventForm
paramProperty=eventId styleClass=eventheaderlink

is missing the last ' and causes error.

So is there a way to do this in html:link?

And is there a need to convert all a to html:link in the first place?
Because I am also having problem converting

a href=mailto:%= htmlescape(contactemail) % class=eventemaillink%=
htmlescape(evcontactemail) %/a

into html:link, since there is no paramId that I can specify, and using
paramId always automatically add a ? to the created link.


Thanks in advance on any pointers,
Ricky Purnomo

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



Initializing application data source org.apache.struts.action.DATA_SOURCE

2003-12-26 Thread Ricky Purnomo
Hello,

I am new to Struts, and am trying to deploy to Tomcat an application that
uses mySQL as database. However I am encountering the following errors:

2003-12-24 14:28:33 StandardWrapper[/necdcstruts1:action]: Marking servlet
action as unavailable
2003-12-24 14:28:33 StandardContext[/necdcstruts1]: Servlet /necdcstruts1
threw load() exception
javax.servlet.UnavailableException: Initializing application data source
org.apache.struts.action.DATA_SOURCE
 at
org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.j
ava:1091)
 at org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
 at javax.servlet.GenericServlet.init(GenericServlet.java:256)
 at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:93
5)
 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823)
 at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:
3422)
 at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3623)
 at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:8
21)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
 at
org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.j
ava:307)
 at org.apache.catalina.core.StandardHost.install(StandardHost.java:788)
 at
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:559
)
 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:401)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:718)
 at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:358)
 at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
t.java:166)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:754)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:363)
 at org.apache.catalina.core.StandardService.start(StandardService.java:497)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
 at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
 at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
 at java.lang.reflect.Method.invoke(Native Method)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)

In addition to the standard jars I have put the following .jar's in
WEB-INF/lib :

commons-pool-1.1.jar
commons-dbcp-1.1.jar
mysql-connector-java-3.0.9-stable-bin.jar

but it doesn't seem to solve the problem. Please advise what else I can try
to identify and resolve the problem.

Thanks in advance,
Ricky Purnomo

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



about using DynaActionForm in SQL Maps framework with Struts...

2003-12-07 Thread Ricky
hi, there, 
has anybody tried to use SQL Maps framework with struts? i am now using
the struts with SQL Maps framework, all is convenient. i have tried to use
ActionForm instead of create a new javaBean passed to SQL Map parameter.
just like this:

AuthorForm authorForm = (AuthorForm) form;

try {
  baseDAO.insertAuthor(authorForm);
} catch(Exception ex) {
  ex.printStackTrace();
}

now, i have a query about using DynaActionForm in it...
assume that i am using DynaActionForm and config in struts-config.xml,
What should i do to pass the dynaformBean to SQL Map parameter?
some code like these, but it threw some exception...

DynaActionForm authorForm = (DynaActionForm) form;
try {
  baseDAO.insertAuthor(authorForm);
} catch(Exception ex) {
  ex.printStackTrace();
}

and in my BaseDAO.java :

  public void insertAuthor(DynaActionForm author) throws DaoException {
try {
  javaDIYDaoManager.startTransaction();

  authorDao.insertAuthor(author);

  javaDIYDaoManager.commitTransaction();
}
catch (DaoException e) {
  try {
javaDIYDaoManager.rollbackTransaction();
  }
  catch (Exception e2) { /* ignore */}
  throw ( (DaoException) e.fillInStackTrace());
}
  }

it threw some exception:

Error executing 'insertAuthor' in 'com/dao/sql/Author.xml'.
 
Check the Parameter Map (or inline parameters).  Check the 'author_name' property. 

Cause: com.ibatis.common.beans.BeansException: There is no READABLE property named

'author_name' in class 'org.apache.struts.action.DynaActionForm'

com.ibatis.common.beans.BeansException: There is no READABLE property named 
'author_name'

in class 'org.apache.struts.action.DynaActionForm'






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



HELP: about to get datasource of struts and pass to logic beans...

2003-12-05 Thread Ricky
hi, there, 

with my project i had several queries about get datasource in struts. i know how 
to get datasource in struts, just as in myAction, use getDataSource method and return 
DataSource object, and go on to get connection  

i also know the logic beans between the Controller and Module, so i create a logic 
bean ,i don't know how to get datasourc of pass the datasource, in some tutorial , i 
got a way to solve this, create a method getDAO(HttpServletRequest request) and pass 
the request to the method to get DataSource, i was lost here, i dont' know what should 
i return in getDAO, should i return a DataSource object or others and in my logic bean 
i can use the datasource and also get connection , statement and resultset object , 
there i have to close it after i finish my process what do you think of this i did 
? in general, when i got a DataSource, i will got a connection from datasource and a 
PrepareStatement and also a ResultSet , when i finished my process, i can close all 
object i opened before in final method of try ...catch...experession.. now what should 
i do to return a proper object in getDAO method and in logic beans i can use the 
object to process logic business...

i appologized for this ... i hope you can give me some suggestion or flow.. thanx!

now here is my flow of struts framework to pass the datasource to the logic beans...  
i hope you can reword if you have some good idea...of correct my mistake... :)

myAction :

myAction extends Action() {
  public ActionForward execute(ActionMapping mapping,
   ActionForm form,
   HttpServletRequest request,
   HttpServletResponse response) {
LogicBean bean = new LogicBean();
Object objcet = bean.doMethod(getDAO(request), other param)
  }
  
  public DataSource getDAO(HttpServletRequest request) {
DataSource ds = null;
ds = getDataSource(request);
return ds;
  }
}

and in my logic bean :

class LogicBean {
  public Objct doMethod(DataSource ds, other param) {
try {
  Connection conn = ds.getConnection();
  PrepareStatment stmt = conn.prepareStatment(SELECT ...);
  stmt.setInt(1,);
  ResultSet rs = stmt.executeQuery();
  
  return Object.;
} catch (SQLException ex) {
  ex.printStactTrace();
} final {
  try {
rs.close();
stmt.close();
conn.close()
  } catch (Exception ex) {
ex.printStactTrace();
  }
}
return null;
  }
}

should i pass the DataSource to my logic beans? otherwise what object should i 
pass





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



validatation : the select field and checkbox field origin value lost...

2003-11-28 Thread Ricky
hi, i'am sorry to trouble you if you receive this mail list about struts, i
hope you can give me a suggetion.

first, i found a question about struts validation . when you submit a form ,
and the validate method will valiate the form field. if the form element is
a text filed, you un-inpute the text filed, you will be noticed that you
must fill the text filed,and the other text field you have filled with some
data, after the form submit, the other text field 's data still in the text
field , but the select field you have choiced before has changed to the
default value, it can't remain the value you choiced before. but the text
filed can keep the value,

what should do to keep the select field 's value to that my selected before
the form submit to check the validation. and the checkbox field is the same
as select field?

i don't know whether you can understand what i said, i don't think i can
express my problem to everyone...

i hope you can understand it... :)

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



help: how to validate a Integer type data. that equals blank...

2003-11-28 Thread Ricky
hello,
   sorry to trouble you of my problem. i hope for the best solution of my
problem.

i am using DynaValidatorForm to validate my form, and i have form-name, a
form property configurate like this:

form-property name=author_id type=java.lang.Integer /

and in my jsp is :

  html:select property=author_id
option value=add new author/option../html:select


and in my validation.xml ,just configurate below..

field property=author_id  depends=required
arg0 key=admin.article.author/

it can't validate properly, until i change the form-property type to
java.lang.String,
i know the validator's depends required must be correspond to a String type,
but i want to keep the java.lang.Integer type, instead of that, i can set
the option value equals 0, and use the Range depends to validate the field,
or use validwhen that compare with 0 to validate the field, but that
depends property hasn't available in Struts 1.1, any better solution about
this case, i want to leave the form-bean type to java.lang.Integer, and if
the option value is blank(), how can i validate this field?

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



Re: validation : the select field and checkbox field origin value lost...

2003-11-28 Thread Ricky
thanks for helping me..  and then i search a question like this at achieve
mailing and it told me use html:option, and i test it, the solution is ok,
but, what a pity, i can't use html:option , because.. if i use it...it
will show me the exception :equal symbol expected
in the jsp page , i use a logic:iterate to add my option element, and can't
nested a html:option in it. just like this.

logic:iterate name=authors id=author
  html:option value=bean:write name=author property=author_id
/bean:write name=author property=author_name //html:option
/logic:iterate

if i use that code above , it shows me the exception... so i have to abandon
the html:option tag, what a pity... :(   i can only use common html syntax
option, so my first problem you replied me come out..

and could anyone have a better solution about my case?

or i can change the login:iterate to java script as java.util.List to use
a loop to get my select option...in fact, i don't want insert a java script
in my page, all of my page are using taglib, none java script within my jsp
page

and what about nested tag... any other better way?



- Original Message -
From: Janice [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, November 29, 2003 12:15 AM
Subject: re: validatation : the select field and checkbox field origin value
lost...


 Hi Ricky,

 After validation, struts will display whatever you specified in the input
 parameter of your action mapping.  If you specify an action (like
 displayForm.do), then all of the processing that is done in that action
will
 be performed before the page is shown.  I suspect this is why the values
on
 the form that were changed have gone back to their defaults.  What you
 probably want to do instead is specify the .jsp page that you would
normally
 forward to upon success (like myForm.jsp).

 hth,
 Janice


 -
 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: Range validation by validation.xml

2003-11-28 Thread Ricky

hi, if the value must be greater than 0. do you have any other better way?
now i am using range , if i don't set the max value, it can't work
,otherwise , set a limited value, i don't know the value that inputed.  i
can use validwhen, but it's not available in Struts 1.1 now :(


- Original Message -
From: Robert Lamping [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Wednesday, November 26, 2003 10:11 PM
Subject: RE: Range validation by validation.xml


Dear Honza,

I would suggest you also supply the maximum value.

var
var-namemax/var-name
var-value99/var-value
/var

The presentation in which you are working already knows something from the
data layer, i.e. the value must be greater than 0.
In order to prevent errors due to storing a value higher than the allowed
value, I would suggest you also enter the maximum value.
When you change the maximum allowed value in the table then indeed you have
to change the validation.xml.
When you rewrite your tests this need for adaptation will pop up.

Kind regards,

Robert


-Original Message-
From: Honza Spurn [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 26, 2003 9:25 AM
To: [EMAIL PROTECTED]
Subject: Range validation by validation.xml


Hi there,

I know, that is possible to validate throught validation.xml file if input
is integer in the specified range... But I would like to check, if the input
number is unsigned int. (It means in the range where minimum is equal to 1
and maximum is not specified -- 1,2,3,4,... ) I would like to range the
input only from the minimum value, but not from the maximum value.

Is any esay way how to do it? I've tried to specified this in
validation.xml, but it doesn't work as I want:

field property=numberForm depends=integer, intRange
var
var-namemin/var-name
var-value1/var-value
/var

arg0 key=tech.gtsID.label/
arg1 .../
/field

Thanks for helping.

Sporak


-
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: Tiles Help! Help with Tiles...

2003-11-28 Thread Ricky
you don't need to put the value again..after you define your definiton in
tile-config.xml,.change your code below :

%@ taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles%
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean%
%@ include  file=/Layout/stdDefinition.jspf%
tiles:insert beanName=stdLayoutDef flush=true
tiles:put name=title  type=stringbean:message
key='title.statusreport' / /tiles:put
tiles:put name=header value=/Layout/stdHeader.jsp /
tiles:put name=body value=/res/error/resStatusReportBody.jsp /
tiles:put name=footer value=/Layout/stdFooter.jsp /
/tiles:insert

to a simple code just like this:

tiles:insert definition=stdLayoutDef /

within the page you will be display the tiles.(not the layout page)



- Original Message -
From: Timo [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Saturday, November 29, 2003 12:48 AM
Subject: Tiles Help! Help with Tiles...


Hi all,
I tried to use tiles-defs.xml to define a tile, but got the following error:

500 Internal Server Error
javax.servlet.jsp.JspException: Error - Tag Insert : No value defined for
bean 'stdLayoutDef' with property 'null' in scope 'null'.
here is my tiles-defs.xml
?xml version=1.0 encoding=ISO-8859-1 ?
   !DOCTYPE tiles-definitions PUBLIC  -//Apache Software Foundation//DTD
Tiles Configurations 1.1//EN
http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd;
tiles-definitions
!--  Standard definitions --
   definition name=stdLayoutDef path=/Layout/stdLayout.jsp
   put name=title  value=Title String /
   put name=header value=/Layout/stdHeader.jsp /
  put name=footer value=/Layout/stdFooter.jsp /
   put name=body   value=/res/error/resStatusReport.jsp /
   /definition
/tiles-definitions

and here where I used the definition:
%@ taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles%
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean%
%@ include  file=/Layout/stdDefinition.jspf%
tiles:insert beanName=stdLayoutDef flush=true
tiles:put name=title  type=stringbean:message
key='title.statusreport' / /tiles:put
tiles:put name=header value=/Layout/stdHeader.jsp /
tiles:put name=body value=/res/error/resStatusReportBody.jsp /
tiles:put name=footer value=/Layout/stdFooter.jsp /
/tiles:insert
Here where I loaded the definition in struts-config.xml...  plug-in
className=org.apache.struts.tiles.TilesPluginset-property
property=definitions-config value=/WEB-INF/tiles-defs.xml/
set-property property=definitions-parser-validate value=true/
set-property property=moduleAware value=true/  /plug-in...so,
what did I do wrong?!!! please help..thanks in advance.

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



Re: Tiles Help! Help with Tiles...

2003-11-28 Thread Ricky
i'am sorry for that i can't reply you as soon as possible. because at that
time, i was so tired, you see, i work for Struts for a long time a day,,  i
have many question about struts, and i can get help from others here, i was
so happy, because i am SOHO'er .. :) i can work in my home...now ,i am using
Struts framework to develop my homepage, i also use tiles...

i belived tiles has more convinience ...

before i used struts and tiles, i read much more tutorials, and have a
favourite of all about struts and tiles. and download more PDF tutorial, i
have learned struts for 2 week, it's powerful..i think.

first, if you have a definition in your tiles-config.xml , you don't insert
any other definition in JSP page and include it(the same definition as in
you tiles-congig.xml) ,you only defined in xml file, and in you layout page,
just like this:


layout.jsp
tiles:insert name=xxx /
tiles:insert name= /

and the page will be displayed named index.jsp , you need to insert ...
tiles:insert definition=xx /

the xx means the definition name in you tiles-config.xml. and the definition
can be extends to other definition and you can use ignore=true to insert
more pageany other function you can see the document about tiles, if you
have some tutorial about tiles and struts, i will send you all my favourits
to you.

hope for help you. :)

i am also a newbie in struts, i also need help for others here, we can help
each other . :)



- Original Message -
From: Timo [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Saturday, November 29, 2003 3:29 AM
Subject: Re: Tiles Help! Help with Tiles...


 Ricky,
 Thanks Alot I re-read your email over and over (before I get some
sleep)
 and did not understand it.
 Just re-read it again today, and got my mistake fixed. thanks a lot.
 - Original Message -
 From: Ricky [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Sent: Friday, November 28, 2003 9:00 AM
 Subject: Re: Tiles Help! Help with Tiles...


  you don't need to put the value again..after you define your definiton
in
  tile-config.xml,.change your code below :
 
  %@ taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles%
  %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean%
  %@ include  file=/Layout/stdDefinition.jspf%
  tiles:insert beanName=stdLayoutDef flush=true
  tiles:put name=title  type=stringbean:message
  key='title.statusreport' / /tiles:put
  tiles:put name=header value=/Layout/stdHeader.jsp /
  tiles:put name=body value=/res/error/resStatusReportBody.jsp /
  tiles:put name=footer value=/Layout/stdFooter.jsp /
  /tiles:insert
 
  to a simple code just like this:
 
  tiles:insert definition=stdLayoutDef /
 
  within the page you will be display the tiles.(not the layout page)
 
 
 
  - Original Message -
  From: Timo [EMAIL PROTECTED]
  To: Struts Users Mailing List [EMAIL PROTECTED]
  Sent: Saturday, November 29, 2003 12:48 AM
  Subject: Tiles Help! Help with Tiles...
 
 
  Hi all,
  I tried to use tiles-defs.xml to define a tile, but got the following
 error:
 
  500 Internal Server Error
  javax.servlet.jsp.JspException: Error - Tag Insert : No value defined
for
  bean 'stdLayoutDef' with property 'null' in scope 'null'.
  here is my tiles-defs.xml
  ?xml version=1.0 encoding=ISO-8859-1 ?
 !DOCTYPE tiles-definitions PUBLIC  -//Apache Software
Foundation//DTD
  Tiles Configurations 1.1//EN
  http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd;
  tiles-definitions
  !--  Standard definitions --
 definition name=stdLayoutDef path=/Layout/stdLayout.jsp
 put name=title  value=Title String /
 put name=header value=/Layout/stdHeader.jsp /
put name=footer value=/Layout/stdFooter.jsp /
 put name=body   value=/res/error/resStatusReport.jsp /
 /definition
  /tiles-definitions
 
  and here where I used the definition:
  %@ taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles%
  %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean%
  %@ include  file=/Layout/stdDefinition.jspf%
  tiles:insert beanName=stdLayoutDef flush=true
  tiles:put name=title  type=stringbean:message
  key='title.statusreport' / /tiles:put
  tiles:put name=header value=/Layout/stdHeader.jsp /
  tiles:put name=body value=/res/error/resStatusReportBody.jsp /
  tiles:put name=footer value=/Layout/stdFooter.jsp /
  /tiles:insert
  Here where I loaded the definition in struts-config.xml...  plug-in
  className=org.apache.struts.tiles.TilesPluginset-property
  property=definitions-config value=/WEB-INF/tiles-defs.xml/
  set-property property=definitions-parser-validate value=true/
  set-property property=moduleAware value=true/
/plug-in...so,
  what did I do wrong?!!! please help..thanks in advance.
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED

Re: Range validation by validation.xml

2003-11-28 Thread Ricky
thx for replying me, but the maximum is from the database...and i don't know
the maximum would bei only want to validate the data wheather  0, if
the value = 0 ,it will shows errors, so i use range to validate the value, i
can offer the minimum value is 1, and i can't provide the maximum... except
for range depends , any other depends for me to validate this case?


- Original Message -
From: Robert Lamping [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Saturday, November 29, 2003 3:01 AM
Subject: RE: Range validation by validation.xml


Dear Ricky,

Why won't you validate the maximum value?
If you don't, then you risk a database exception, if the value entered is
too high.
Is that the result you want?

Robert

-Original Message-
From: Ricky [mailto:[EMAIL PROTECTED]
Sent: Friday, November 28, 2003 5:54 PM
To: Struts Users Mailing List
Subject: Re: Range validation by validation.xml



hi, if the value must be greater than 0. do you have any other better way?
now i am using range , if i don't set the max value, it can't work
,otherwise , set a limited value, i don't know the value that inputed.  i
can use validwhen, but it's not available in Struts 1.1 now :(


- Original Message -
From: Robert Lamping [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Wednesday, November 26, 2003 10:11 PM
Subject: RE: Range validation by validation.xml


Dear Honza,

I would suggest you also supply the maximum value.

var
var-namemax/var-name
var-value99/var-value
/var

The presentation in which you are working already knows something from the
data layer, i.e. the value must be greater than 0.
In order to prevent errors due to storing a value higher than the allowed
value, I would suggest you also enter the maximum value.
When you change the maximum allowed value in the table then indeed you have
to change the validation.xml.
When you rewrite your tests this need for adaptation will pop up.

Kind regards,

Robert


-Original Message-
From: Honza Spurn [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 26, 2003 9:25 AM
To: [EMAIL PROTECTED]
Subject: Range validation by validation.xml


Hi there,

I know, that is possible to validate throught validation.xml file if input
is integer in the specified range... But I would like to check, if the input
number is unsigned int. (It means in the range where minimum is equal to 1
and maximum is not specified -- 1,2,3,4,... ) I would like to range the
input only from the minimum value, but not from the maximum value.

Is any esay way how to do it? I've tried to specified this in
validation.xml, but it doesn't work as I want:

field property=numberForm depends=integer, intRange
var
var-namemin/var-name
var-value1/var-value
/var

arg0 key=tech.gtsID.label/
arg1 .../
/field

Thanks for helping.

Sporak


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



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



Re: validation : the select field and checkbox field origin value lost...

2003-11-28 Thread Ricky
thanks for helping me! i have been solved it.. your idea was very good!

before i use %=(String)an_author%, it throws a exception,
'[ServletException in:/tiles/admin/selectAuthor.jsp] null'

i don't know why, because the author_id data type is a java.lang.Integer...

until i changed it to %=an_author.toString()% , now ,it's work...



- Original Message -
From: Claire Wall [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Saturday, November 29, 2003 12:56 AM
Subject: Re: validation : the select field and checkbox field origin value
lost...


 Ricky,

 it is possible to do what you wish to do by doing the following (example
 taken from a similiar thing that i did):

   logic:iterate id=user name=myForm property=users
   bean:define id=id property=id name=user/
html:option value=%= (String)id %bean:write name=user
 property=username//html:option
   /logic:iterate

 here i am iterating through a list of User objects in my form (my User
 object is basically a class with the fields 'id' and 'username'). By using
 bean:define.. you can then use a JSP expression to set the value of the
 html:option using the id of the bean:define. So in your case it will
be
 something like:

 logic:iterate name=authors id=author
   bean:define id=an_author property=author_id name=author/
   html:option value=%= (String)an_author %
 bean:write name=author property=author_name /
 /html:option
 /logic:iterate


 hope this helps
 claire

 - Original Message -
 From: Ricky [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Sent: Friday, November 28, 2003 4:37 PM
 Subject: Re: validation : the select field and checkbox field origin value
 lost...


  thanks for helping me..  and then i search a question like this at
achieve
  mailing and it told me use html:option, and i test it, the solution is
 ok,
  but, what a pity, i can't use html:option , because.. if i use it...it
  will show me the exception :equal symbol expected
  in the jsp page , i use a logic:iterate to add my option element, and
 can't
  nested a html:option in it. just like this.
 
  logic:iterate name=authors id=author
html:option value=bean:write name=author property=author_id
  /bean:write name=author property=author_name //html:option
  /logic:iterate
 
  if i use that code above , it shows me the exception... so i have to
 abandon
  the html:option tag, what a pity... :(   i can only use common html
 syntax
  option, so my first problem you replied me come out..
 
  and could anyone have a better solution about my case?
 
  or i can change the login:iterate to java script as java.util.List to
 use
  a loop to get my select option...in fact, i don't want insert a java
 script
  in my page, all of my page are using taglib, none java script within my
 jsp
  page
 
  and what about nested tag... any other better way?
 
 
 
  - Original Message -
  From: Janice [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Saturday, November 29, 2003 12:15 AM
  Subject: re: validatation : the select field and checkbox field origin
 value
  lost...
 
 
   Hi Ricky,
  
   After validation, struts will display whatever you specified in the
 input
   parameter of your action mapping.  If you specify an action (like
   displayForm.do), then all of the processing that is done in that
action
  will
   be performed before the page is shown.  I suspect this is why the
values
  on
   the form that were changed have gone back to their defaults.  What you
   probably want to do instead is specify the .jsp page that you would
  normally
   forward to upon success (like myForm.jsp).
  
   hth,
   Janice
  
  
   -
   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]



DynaActionForm basic problem.

2003-11-26 Thread Ricky Yahoo
hi, thanks for helping me! i have a problem by using DynaActionForm..
some fragment of my struts-config.xml about form bean is:

!-- article bean --
form-bean name=articleBean type=com.struts.bean.DynaArticleForm
  form-property name=article_id type=java.lang.Long /
  form-property name=article_title type=java.lang.String /
  form-property name=post_date type=java.sql.Date /
/form-bean

and the class com.struts.bean.DynaArticleForm is extends DynaActionForm
Class to validate the form .and it directly to the excuse method of Action

public class DynaArticleForm
extends DynaActionForm {
  public ActionErrors validate(ActionMapping mapping,
   HttpServletRequest request) {
ActionErrors errors = new ActionErrors();

errors.add(author_id, new
ActionError(admin.article.author.missing));
return errors;
  }

but the process can't return any errors, in fact, i have added the errors to
ActionErrors
i follow the article in
http://www.developer.com/java/ejb/article.php/2214681 and it says:

We also need to change the definition of the form in struts-config.xml to
use this new class instead of the generic DynaActionForm class. When we do
this, the validation functionality is returned

what's the problem with my program ? could you please tell me. thanx

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



Re: DynaActionForm basic problem.

2003-11-26 Thread Ricky Yahoo
a moment later, i have found the reasons :)

- Original Message -
From: Ricky Yahoo [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Wednesday, November 26, 2003 10:44 PM
Subject: DynaActionForm basic problem.


 hi, thanks for helping me! i have a problem by using DynaActionForm..
 some fragment of my struts-config.xml about form bean is:

 !-- article bean --
 form-bean name=articleBean type=com.struts.bean.DynaArticleForm
   form-property name=article_id type=java.lang.Long /
   form-property name=article_title type=java.lang.String /
   form-property name=post_date type=java.sql.Date /
 /form-bean

 and the class com.struts.bean.DynaArticleForm is extends DynaActionForm
 Class to validate the form .and it directly to the excuse method of Action

 public class DynaArticleForm
 extends DynaActionForm {
   public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
 ActionErrors errors = new ActionErrors();

 errors.add(author_id, new
 ActionError(admin.article.author.missing));
 return errors;
   }

 but the process can't return any errors, in fact, i have added the errors
to
 ActionErrors
 i follow the article in
 http://www.developer.com/java/ejb/article.php/2214681 and it says:

 We also need to change the definition of the form in struts-config.xml to
 use this new class instead of the generic DynaActionForm class. When we do
 this, the validation functionality is returned

 what's the problem with my program ? could you please tell me. thanx

 -
 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: New to Struts !

2003-11-26 Thread Ricky
you have to build a action-mapping in struts-config.xml, take a look at
http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd to validate the
struts-config.xml form to insert action-mapping

just like:
action type=com.struts.action.tiles.xxxAction validate=false
scope=request path=/moduleListAction /

i hope it can help you.  :)


- Original Message -
From: Rama, Shreekantha (K.) [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, November 27, 2003 12:34 AM
Subject: New to Struts !


 Hi All,

 I am new to struts.
 I have the following lines of code in my jsp.

 logic:notEqual name=createForm property=baseXXXVO.method
value=maintain

 %
 FORMTITLE=foms.create.title;
 %

 /logic:notEqual

 In struts-config.xml the entry is
 form-bean  name=createForm
 type=com.xxx.action.createForm/


 I am getting the error as

 Error 500: Cannot find bean createForm  in any scope


 Any help ??


 Regards
 Shree

 -
 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: Checkbox and Map ActionForm

2003-11-26 Thread Ricky
why not use JSTL c:forEach.? :)
- Original Message -
From: Ryan [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, November 27, 2003 12:31 AM
Subject: Checkbox and Map ActionForm


 I have checkboxes on my form that have multiple options/group.
 The name for each group of checkboxes is generated from the database, so
 I decided to use a map on my action form to collect the checkbox values
 since the names of the checkbox are not known.

 However, when more than one option is selected within a group, BeanUtils
 turns the array passed from the checkbox into the first value of the
array.

 For example, if for box1 1,3,4 are selected, box1's value in the map is 1.

 Is there a way to collect the values submitted by a checkbox group
 without knowing the name of this group beforehand?

 Thanks
 Ryan



 The html form:

 html:form action=/setMethods scope=request
 html:checkbox property=value(box1) value=1/1
 html:checkbox property=value(box1) value=2/2
 html:checkbox property=value(box1) value=3/3
 html:checkbox property=value(box1) value=4/4
 html:checkbox property=value(box1) value=5/5
 brbr
 html:checkbox property=value(box2) value=a/a
 html:checkbox property=value(box2) value=b/b
 html:checkbox property=value(box2) value=c/c
 br
 input type=submit
 /html:form

 The action form

 public class FooForm extends ActionForm {

  private final Map values = new HashMap();

  public void setValue(String key, Object value){
  values.put(key, value);
  }
  public Object getValue(String key){
  return values.get(key);
  }

 }



 -
 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: Does Taglibs cause any performance Issues ???

2003-11-25 Thread Ricky Lee
i suggest you use taglib ,especially JSTL, i think we should use less java
script in jsp page, do more action in actio servlet, it can make you more
convinient.

i was glad that i use taglib into my project, more use it, more convinient
you be.
- Original Message -
From: Shakti [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Tuesday, November 25, 2003 7:15 PM
Subject: Does Taglibs cause any performance Issues ???


Hi All,
  I want to know whether use of taglibs in jsp cause any kind of
performance issues. Someone told me that i should avoid using taglibs becuz
they r being loaded into memory and in many cases during stress testing
applications have failed because of excess use of taglibs . I want to know
your views regarding this !

Cheers..
Shakti



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



coundn't be a nested code like this?

2003-11-25 Thread Ricky Lee
hi, struts exper! i have a problem about struts taglib, like these code
below:

html:form action=tiles:getAsString name=form_action /

it show me the exception:

rg.apache.jasper.JasperException: /layouts/admin/addDataLayout.jsp(15,48)
equal symbol expected

and when i change to the follow codes , it remain showed me the same
exception..


tiles:useAttribute name=form_action /
html:form action=bean:write name=form_action /

my tiles configuration is:

definition name=.admin.add.article extends=.admin.page
 put name=form_action  value=/addArticleActiontype=string
/
 put name=admin_select_author  value=.admin.select.author
type=definition /
/definition

i want to set the property into tiles context and get it from jsp page as
string to set the form action property

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



Re: Basic question about html:

2003-11-25 Thread Ricky Lee
hi, so glad that i met the same question as you

html:form action=/addArticleAction
module id:
html:select property=module_id
logic:iterate name=modules id=module
option value=bean:write name=module property=module_id
/abc/option
/logic:iterate
/html:select
article title:html:text property=article_title /
br
/html:form

and it show me the errors:

equal symbol expected

---
can't nested tag like that? any solution about this?





- Original Message -
From: Raman [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Tuesday, November 25, 2003 8:11 PM
Subject: Basic question about html:


 hello all,
 i have a basic problem in html:radio
 I want to use it in the loop for radio buttons. But facing problems in
 setting the value of the control. i have tried

 html:radio property=id value=bean:write
name=filters property=FilterId /

 but this is not working.

 Any help regarding this??


 -
 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: Basic question about html:

2003-11-25 Thread Ricky Lee
thanks ,it can be work now, but what about this one?

html:form action=tiles:getAsString name=form_action /

it show me the exception:

rg.apache.jasper.JasperException: /layouts/admin/addDataLayout.jsp(15,48)
equal symbol expected

and when i change to the follow codes , it remain showed me the same
exception..


tiles:useAttribute name=form_action /
html:form action=bean:write name=form_action /

my tiles configuration is:

definition name=.admin.add.article extends=.admin.page
 put name=form_action  value=/addArticleActiontype=string
/
 put name=admin_select_author  value=.admin.select.author
type=definition /
/definition

i want to set the property into tiles context and get it from jsp page as
string to set the form action property




- Original Message -
From: Ben Anderson [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, November 25, 2003 8:27 PM
Subject: Re: Basic question about html:


 if that's how you want to do it you need to change your quotes from:
 option value=bean:write name=module
 property=module_id/abc/option
 to:
 option value='bean:write name=module
 property=module_id/'abc/option


 From: Ricky Lee [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Subject: Re: Basic question about html:
 Date: Tue, 25 Nov 2003 20:21:29 +0800
 
 hi, so glad that i met the same question as you
 
 html:form action=/addArticleAction
 module id:
 html:select property=module_id
 logic:iterate name=modules id=module
 option value=bean:write name=module property=module_id
 /abc/option
 /logic:iterate
 /html:select
 article title:html:text property=article_title /
 br
 /html:form
 
 and it show me the errors:
 
 equal symbol expected
 
 ---
 can't nested tag like that? any solution about this?
 
 
 
 
 
 - Original Message -
 From: Raman [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Sent: Tuesday, November 25, 2003 8:11 PM
 Subject: Basic question about html:
 
 
   hello all,
   i have a basic problem in html:radio
   I want to use it in the loop for radio buttons. But facing problems in
   setting the value of the control. i have tried
  
   html:radio property=id value=bean:write
  name=filters property=FilterId /
  
   but this is not working.
  
   Any help regarding this??
  
  
   -
   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]
 

 _
 Is there a gadget-lover on your gift list?  MSN Shopping has lined up some
 good bets!  http://shopping.msn.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]



bug of struts bean taglib?

2003-11-25 Thread Ricky Lee
hi,i get a problem in my program. when i copy the struts-excercise-taglib
example file (bean-write.jsp, just some fragment below) to a new web
application(with strut1.1 under tomcat 4.1.29) and test it, it can't work
and showed me the errors below, but i test the bean-write.jsp under
struts-excercise-taglib folder, it can work smoothly , after that, i found a
problem, if i add the code below into web.xml of my new web application ,the
bean-write i created before can work smoothly, when i remove that, i can't
work:

my bean-write.jsp
---
%@ page language=java %
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %

%
pageContext.setAttribute(test1.int, new Integer(123));
pageContext.setAttribute(test1.string, This is a string);
%

bean:write name=test1.int/

//-- but when i remove this line above, leave string type alone , it can
work also.

bean:write name=test1.string/ //leave this alone , can work


if i add this configuation

-
..
init-param
param-nameapplication/param-name
param-value/param-value
/init-param
---

to web.xml after servlet
servlet-nameaction/servlet-name
servlet-classorg.apache.struts.action.ActionServlet/servlet-class

... it can work
when i remove the configuation above , it can't work and show below:

could some one help me? is it a bug of write bean? or i must add the
configuration into web.xml, even then i didn't set any value of the
application property of servlet?



HTTP Status 500 -




type Exception report

message

description The server encountered an internal error () that prevented it
from fulfilling this request.

exception

org.apache.jasper.JasperException: Cannot find message resources under key
org.apache.struts.action.MESSAGE
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
54)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:256

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



bean:write basic question.

2003-11-25 Thread Ricky Lee
hi,i get a problem in struts taglib. i test the bean-write.jsp under
struts-excercise-taglib folder, it can work smoothly , if i create a new
application, and test bean-write.jsp, it can't work, after that, i found a
problem, if i add the code below into web.xml of my new web application ,the
bean-write i created before can work smoothly, when i remove that, i can't
work:

web.xml
-
..
init-param
param-nameapplication/param-name
param-value/param-value
/init-param
---

my bean-write.jsp
---
%@ page language=java %
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %

%
pageContext.setAttribute(test1.int, new Integer(123));
pageContext.setAttribute(test1.string, This is a string);
%
bean:write name=test1.int/
bean:write name=test.string/


if i remove bean:write name=test1.int/ or change it to
bean:write name=test1.int format= / it can be work properly too.


could some one help me? should i necessarily add the
configuration above into web.xml it can be work? even then i didn't set any
value of the
application property of servlet?
if i don't add configuration to web.xml, why i add a property 'format='
into bean:write it also can work?



HTTP Status 500 -




type Exception report

message

description The server encountered an internal error () that prevented it
from fulfilling this request.

exception

org.apache.jasper.JasperException: Cannot find message resources under key
org.apache.struts.action.MESSAGE
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
54)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:256



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



HTTP Reply Already Emitted - File Upload - ActionServlet - Exception Handling

2001-09-14 Thread Ricky Frank

I am having a problem with the FileUpload provided with Struts.  You can 
set a maximum size for the file being uploaded.  The problem occurs when 
the FileUpload process reaches the maximum file size.  A ServletException 
is thrown stating that the max size limit has been reached (and the upload 
stops); however, I can't seem to catch it in any code or even use the 
errorpage functionality within JSP.  When I use the errorpage, I can see 
that my error page is being called and processed, but I get the following 
error message (from the SilverStream console - both business object and 
client logging set):

AgoServletOutputStream.flush m_committed=true m_noflush=false
AgoServletOutputStream.flush m_committed=true m_noflush=false
AgoServletOutputStream.close
AgoServletOutputStream.flush m_committed=true m_noflush=false
AgoServletOutputStream.sendLastChunk
AgoHttpReplyEvent.completeContent() m_redirected=false
AgoServletOutputStream.close
   [CLI0-4ec31c19a91c4ad79c2bb3f74d6c05d3] Reply was already emitted:
c0;client0: idle.
java.lang.RuntimeException: Bad request, no URL !
 at 
com.sssw.shr.http.HttpRequestMessage.notifyBeginParsing(HttpRequestMessage.java:187)
 at com.sssw.shr.mime.MimeParser.parse(MimeParser.java:104)
 at com.sssw.srv.http.Client.getNextRequest(Client.java:334)
 at com.sssw.srv.http.Client.loop(Client.java:1194)
 at com.sssw.srv.http.Client.runConnection(Client.java:1421)
 at com.sssw.srv.http.Client.run(Client.java:1381)
 at java.lang.Thread.run(Thread.java:484)
   [CLI0-4ec31c19a91c4ad79c2bb3f74d6c05d3] Replying:
HTTP/1.1 500 Internal Server Error
Date: Fri, 14 Sep 2001 13:00:47 GMT
Content-Length: 121
Content-Type: text/html
Server: SilverStream Server/10.0

In the browser, I get a DNS not found error.  I think this is from the HTTP 
reply already being emitted and then trying to forward to the error 
page.  I have changed my Struts configuration to redirect instead of 
forwarding but to no avail.  From my Action, I tried throwing a new 
ServletException to see if the error page is display - it is.  That means 
there is something going on in the FileUpload process.  Any ideas??


Thanks!
Ricky Frank




Re: Multipart File Upload Struts Example

2001-09-13 Thread Ricky Frank

Yes, under the webapps directory of wherever you installed Struts, there is 
a struts-upload.war file that contains everything you should need.

Ricky

At 10:41 AM 9/13/2001 -0400, you wrote:
Is there a Struts example of how to upload files using the built-in
org.apache.struts.upload package?

Thanks!

Pierre


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




RE: file upload problems

2001-09-13 Thread Ricky Frank

I am trying to accomplish the same thing but am taking a different 
approach.  I have not changed any Struts code, instead I am trying to use 
the error page functionality to handle the ServletException.  I tried a 
file upload with the same limitations as you mention below and did not have 
a problem with the browser continuing to upload.  My problem, however, is 
that the error page is not being displayed.  I can see in the trace that it 
is being called but then just as it should be displayed in the browser I 
get a RuntimeException:

java.lang.RuntimeException: Bad request, no URL !
 at 
com.sssw.shr.http.HttpRequestMessage.notifyBeginParsing(HttpRequestMessage.java:187)
 at com.sssw.shr.mime.MimeParser.parse(MimeParser.java:104)
 at com.sssw.srv.http.Client.getNextRequest(Client.java:334)
 at com.sssw.srv.http.Client.loop(Client.java:1194)
 at com.sssw.srv.http.Client.runConnection(Client.java:1421)
 at com.sssw.srv.http.Client.run(Client.java:1381)
 at java.lang.Thread.run(Thread.java:484)

I then get a DNS server not found error in the browser.

I believe that it has something to do with how Struts is forwarding control 
to the error page.  I'm not sure but I think it might be because the 
response was already committed by the time the forward is taking 
place.  I tried reconfiguring Struts to use a redirect instead of a forward 
but that didn't seem to help.  Anyone have any ideas?

Ricky



At 12:04 PM 9/13/2001 -0700, you wrote:
Hello,

Does anybody know what I can do to resolve the following problem with the
file upload?

Summary of problem:

When I try to upload a file larger than the maximum limit allowed, the 
Maximum
length exceeded message doesn't appear on the screen until the entire file
is uploaded.  In other words, even though the server throws 
MaxLengthExceededException
right away, the browser keeps processing the file.  I can't figure out a
way to cancel the processing so that the message is displayed right away!

This happens within Struts Framework as well as outside Struts framework.




Detail Description:

To see how Struts handles file uploading here's what I am doing;

1)  One of the business requirement for my project is that the user is not
allowed to attach files larger than a certain limit.
2)  To catch this condition I added 'maxFileSize' to web.xml (as described
in the attached email).
3)  This is when I started getting MaxLengthExceededException and Internal
Server Error (as described in the attached email).
4)  To resolve this temporarily, I decided to play around with the struts
code, so I changed the code to pass the 'MaxLengthExceededException' all
the way up to the ActionServlet.  I changed the following methods;

MultipartIterator Constructor
DiskMultipartRequestHanlder.handleRequest()
RequestUtils.populate()
ActionServlet.processPopulate()
ActionServlet.process()

5)  This works really well for files of small size.  But when I set the
maxFileSize to 1Meg and try to upload a 30Meg file the server throws the
MaxLengthExceededException right away, but the browser keeps processing
the 30Meg file.  The Maximum file limit exceeded message doesn't show
up for about 10 minutes - until the browser is finished processing the file.
  Is there a way to cancel browser processing right away?

Thanks for your time.

- Ajay


 
 -Original Message-
 From: Ajay Chitre [mailto:[EMAIL PROTECTED]]
 Sent: Monday, September 10, 2001 11:56 PM
 To: [EMAIL PROTECTED]
 Subject: RE: file upload problems
 
 
 Mike,
 
 I tried setting the maxFileSize as follows;
 
 init-param
   param-namemaxFileSize/param-name
   param-value100K/param-value
 /init-param
 
 This throws a MaxLengthExceededException as expected.  I would like to
catch
 this exception and show a user friendly message on the screen.  How can
I
 do
 that?  Please help
 
 
 Here's what I am doing;
 
 1)  I unzipped the struts-upload.war file that came with Struts 1.0.  (I
 believe you wrote this sample app - thanks!)
 2)  In the web.xml I made the changes shown above.
 3)  I ran this app in Weblogic 5.1 (sp 9) and Tomcat 3.2.3.  In both cases,
 when I submit a file larger than 100K I get
 a MaxLengthExceededException and I get Error 500 - Internal Server Error
 on
 the screen.
 
 
 Here's my understanding of the problem - Please ignore this if it doesn't
 make sense...
 
 This exception is thrown in the BufferedMultipartInputStream constructor.
 Shouldn't this exception be passed all the way up to the
 ActionServlet.processPopulate()?  This method has access to the
 'formInstance' which can be used to notify the user.  Does this make sense?
 
 Anyway, any help in this matter will be greatly appreciated.  Thanks.
 
 - Ajay
 
 
 
 -Original Message-
 From: SCHACHTER,MICHAEL (HP-NewJersey,ex2) [mailto:[EMAIL PROTECTED]]
 Sent: Monday, September 10, 2001 10:18 AM
 To: '[EMAIL PROTECTED]'
 Subject: RE: file upload problems
 
 
 Ricky

RE: file upload problems

2001-09-11 Thread Ricky Frank

I have the exact same problem and am looking for the same answer


At 11:55 PM 9/10/2001 -0700, you wrote:
Mike,

I tried setting the maxFileSize as follows;

 init-param
   param-namemaxFileSize/param-name
   param-value100K/param-value
 /init-param

This throws a MaxLengthExceededException as expected.  I would like to catch
this exception and show a user friendly message on the screen.  How can I do
that?  Please help


Here's what I am doing;

1)  I unzipped the struts-upload.war file that came with Struts 1.0.  (I
believe you wrote this sample app - thanks!)
2)  In the web.xml I made the changes shown above.
3)  I ran this app in Weblogic 5.1 (sp 9) and Tomcat 3.2.3.  In both cases,
when I submit a file larger than 100K I get
a MaxLengthExceededException and I get Error 500 - Internal Server Error on
the screen.


Here's my understanding of the problem - Please ignore this if it doesn't
make sense...

This exception is thrown in the BufferedMultipartInputStream constructor.
Shouldn't this exception be passed all the way up to the
ActionServlet.processPopulate()?  This method has access to the
'formInstance' which can be used to notify the user.  Does this make sense?

Anyway, any help in this matter will be greatly appreciated.  Thanks.

- Ajay



-Original Message-
From: SCHACHTER,MICHAEL (HP-NewJersey,ex2) [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 10, 2001 10:18 AM
To: '[EMAIL PROTECTED]'
Subject: RE: file upload problems


Ricky,

The maximum upload size is represented as an init-param for ActionServlet:

To set it as an init-param in web.xml:

servlet
 servlet-nameaction/servlet-name
 servlet-classorg.apache.struts.action.ActionServlet/servlet-class
 init-param
   param-namemaxFileSize/param-name
   param-value100K/param-value
 /init-param
 load-on-startup2/load-on-startup
/servlet

The value of maxFileSize can be represented as in bytes by not appending
any
characters to the end, kilobytes by appending a K at the end, megabytes by
appending an M at the end, and gigabytes by appending a G at the end.

Example:

100 bytes:
servlet
 servlet-nameaction/servlet-name
 servlet-classorg.apache.struts.action.ActionServlet/servlet-class
 init-param
   param-namemaxFileSize/param-name
   param-value100/param-value
 /init-param
 load-on-startup2/load-on-startup
/servlet

100 kilobytes:

servlet
 servlet-nameaction/servlet-name
 servlet-classorg.apache.struts.action.ActionServlet/servlet-class
 init-param
   param-namemaxFileSize/param-name
   param-value100K/param-value
 /init-param
 load-on-startup2/load-on-startup
/servlet

100 Megabytes:

servlet
 servlet-nameaction/servlet-name
 servlet-classorg.apache.struts.action.ActionServlet/servlet-class
 init-param
   param-namemaxFileSize/param-name
   param-value100M/param-value
 /init-param
 load-on-startup2/load-on-startup
/servlet

100 Gigabytes
servlet
 servlet-nameaction/servlet-name
 servlet-classorg.apache.struts.action.ActionServlet/servlet-class
 init-param
   param-namemaxFileSize/param-name
   param-value100G/param-value
 /init-param
 load-on-startup2/load-on-startup
/servlet



-Original Message-
From: Ricky Frank [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 10, 2001 12:29 PM
To: [EMAIL PROTECTED]
Subject: RE: file upload problems


Can you also provide an example of the tag for limiting the size of the
file uploaded?  Or is this not supported?  I've dug through some of the
underlying code and it looks like it is but I don't see anything in the tag
definition on how to invoke this limitation.  Thanks.  Ricky Frank

At 12:10 PM 9/10/2001 -0400, you wrote:
 Rightfully Disgruntled File Upload Users,
 
 I'll set aside some time next week to address
 all the file upload issues, I apologize for the
 long delay.
 
 In the interim, please use bug reports
 (http://nagoya.apache.org/bugzilla/)
 to report all file upload issues that you
 come across.  Check to see if it's reported,
 if not, go ahead and do so.  This notifies
 me directly.
 
 
 -Original Message-
 From: Tom Tibbetts [mailto:[EMAIL PROTECTED]]
 Sent: Monday, September 10, 2001 9:59 AM
 To: [EMAIL PROTECTED]
 Subject: file upload mangling files
 
 
 Hi.  What's the status on fixing the file upload problem of files getting
 mangled?  I use Struts ver 1.0.  Is there a fix available??? Thanks, This
 is very important to us.  Tom Tibbetts


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




RE: file upload problems

2001-09-10 Thread Ricky Frank

Can you also provide an example of the tag for limiting the size of the 
file uploaded?  Or is this not supported?  I've dug through some of the 
underlying code and it looks like it is but I don't see anything in the tag 
definition on how to invoke this limitation.  Thanks.  Ricky Frank

At 12:10 PM 9/10/2001 -0400, you wrote:
Rightfully Disgruntled File Upload Users,

I'll set aside some time next week to address
all the file upload issues, I apologize for the
long delay.

In the interim, please use bug reports
(http://nagoya.apache.org/bugzilla/)
to report all file upload issues that you
come across.  Check to see if it's reported,
if not, go ahead and do so.  This notifies
me directly.


-Original Message-
From: Tom Tibbetts [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 10, 2001 9:59 AM
To: [EMAIL PROTECTED]
Subject: file upload mangling files


Hi.  What's the status on fixing the file upload problem of files getting
mangled?  I use Struts ver 1.0.  Is there a fix available??? Thanks, This
is very important to us.  Tom Tibbetts


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com