Re: bean value within src of html:Image

2004-10-21 Thread dmu2201
Tito Eritja wrote:
How to use some bean value within a html:Image src?
I've tried something like  but
it doesn't work, there's something like paramName and paramProperty of
html:link tag for html:Image?
thanks in advance
tito
 

Why not use EL?! Then you could type:

You just have to remember to type this:
 <%@ page isELIgnored= "false" %>
in the top of the JSP page.
That works for me...
Claus
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Question regarding formbeans

2004-10-21 Thread dmu2201
Vinicius Carvalho wrote:
Hi there!
I have the following problem:
My form offers the ability to a user select from some categories, 
let's say first grade, second grade
on the next step user selects subjects for each one:

first grade:
MathEnglishScience
second grade:
MathEnglish History
As you can see, a subject can participate on more than one grade. 
Those values are retreived and then the form must be
dynamic created. Now that's my question? What can I do about it? Is it 
possible to create an array of those dtos? I'm kinda lost with this 
issue.

There's another one similar to that, refering to textareas, I must 
create n textAreas for the user, depending on how many I've got on my 
database (it's like a metadata)

Any ideas please?
If I understand you correctly I have had the same problem here, trying 
to dynamically use nested properties in a JSP page using Struts.

The way that I solved it was using EL combined with  tags with 
an index, a little like this:
If you have the grades in one array, called grades, stored in session 
scope, and the underlying properties, the subjects, contained as 
properties in those grades objects I would do this:

 
 
 


Here I assume that you have a little like these objects:
grade:
  private Subject[] subjects;
public Subject[] getSubjects();
subject:
  private String title;
  public String getTitle();
Hope that helps a little...
Claus
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Exception handling not working

2004-10-21 Thread dmu2201
Hi ML...
I have a problem with my exception handling mechanisem. If I write:

 
I get nothing... The stacktrace causing the exception just dumps it in 
the browser instead of forwarding to Error.jsp. I get the same result 
trying to define exception handling in an 'action' definition... Is it 
me forgetting something or...?!

Thanks in advance...
Claus
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: reusing actionform

2004-10-21 Thread dmu2201
Shahin Hadjikuliev wrote:
Hi , list
I have a form in one action , and I want to get access to the fields
of  this form in the next actions , have I any ways to do it other
then putting in session?
thanx
 

Propably not, since the response and request objects are new objects 
each time you make a request/response. If you want to have the 
ActionForm's from one request to the next you have to put it in the 
session scope. You don't have to take every value out of the form, just 
put the entire form in the session object...

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


Re: Struts Validator and dynamically generated form fields

2004-10-21 Thread dmu2201
Thompson Marzagao wrote:
Hi all,
I am generating some form field names dynamically, based on the value 
of a request variable. Since I am using Niall Pemberton's 
LazyValidatorActionForm (see http://www.niallp.pwp.blueyonder.co.uk/), 
I don't have a problem getting their values. The problem is validating 
them.

Currently I have to specify in the validation.xml file all fields that 
I want validated. Since I am generating some form fields on the fly, I 
can't hardcode their names in the validation.xml file.

Does anybody know of a way around this? I guess I could always extend 
the LazyValidatorActionForm class with my own implementation of the 
validate method, but does anybody have a better way, so I can still 
have all my validation specified inside the validation.xml file?

Thanks,
Thompson
Is the forms dynamic in a way that the names of the fields is also 
changing, or is the field names the same?! If they are then you can 
specify them in struts-config.xml as form-beans with properties, but of 
course, then all of the validation rules would have to have the same 
parameters each time. In my project the change each time so I had to 
write the validate(...) method myself, but did it in a way where the 
validation logic, the classes that perform the actually validation, was 
external, so they could be reused.

I guess the ultimative workaround would be a code-generator that wrote 
the struts-config and the validation config on the fly ;-)

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


Re: mulitpage form in struts

2004-10-26 Thread dmu2201
Ashish Kulkarni wrote:
Hi
Is there example for handling multipage form, which
handles validation on each page, and handle
forward-backward navigation buttons.
Ashish
 

Hi Ashish
Could you ellaborate what you mean? The way I'm understandig this is 
that you have severeal pages with a form on each of them, and you would 
like to handle the forward-backward buttons, where someone would push 
back and answer the same form again, am I right?!

Well, then the answer must be no, there are no one that have solved this 
problem for you, yet, but it can be done! I have just developed an 
application where I had to handle the back button. The way I did it was 
to use a hidden field on the form, plus using an ID in the session 
object. Whenever someone submitted the form I'm checking to see if the 
ID from the form is the same as the ID from in the session object. If 
not then I would in the same instance know what form was submitted, 
handle that, and forward the user to the next form.

I'm not sure that this is what you are looking for, but it is a start...
Claus
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: General Question in JSP

2004-10-26 Thread dmu2201
Rajesh wrote:
Hai McGrady 

I cant get you .
I am writing a public final class inside that a normal public function which
created a db connection and workis with it 

Inside finally of that function am calling static functiosn like
Commons.closeResultSet(resultSet);
Commons.closeStatement(oStatement);
Commons.closeConnection(oConnection );
Inside each close function i write
If (obj != null) {
obj.close();
 obj = null;
}
Will this makes slowdown ?
Regards,
Rajmahendra R. Hegde
GK Bharani Software Pvt. Ltd.
There are two ways of constructing a software design. One way is to make it
so simple that there are obviously no deficiencies. And the other way is to
make it so complicated that there are no obvious deficiencies. 
   -- C.A.R. Hoare

-Original Message-
From: Michael G. McGrady [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 27, 2004 11:33 AM
To: Struts Users Mailing List
Subject: Re: General Question in JSP

If you call a function inside another function and there is not decoupling
and multithreading involved, then, of course, all things being equal, the
first function cannot continue until the second completes.  Is that an
answer to your question?
crack
On Wed, 27 Oct 2004 11:13:08 +0530, Rajesh <[EMAIL PROTECTED]> wrote:
 

Hai all
in Web prgramming (Struts,JSP,Servlet)
if i call a static function say in a package Commons class having a 
static functioin closeConnection(Connection con);

which will globally closses any connection object which is passed inside
   

it.
 

if i call this package class to all db calls in my package will this 
slowdown my code executions ?
   

Every method call takes some time, which you can't avoid, so of course 
you could say that every method call would slow down your code, 
especially if you use recursive methods, but the overhead of calling a 
method is not that big! If think the biggest slowdown is the database 
connection, but that is a "prize" worth paying...

Not sure if that is what you are looking for...
Claus
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: use EL in Struts 1.1

2004-10-27 Thread dmu2201

is it possible to use EL in Struts 1.1 ?

Yes it is. Just insert this in the top of your JSP page:
<%@ page isELIgnored="false" %>
Enjoy...
Claus
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: use EL in Struts 1.1

2004-10-27 Thread dmu2201
Hi Rajesh
In layout page in a tile page am passing a querystring(parameter) as
?CategoryId=3
If i need to display can i just add it as

 

I'm afraid not since the method signature is 
request.getParameter(String) and what you are trying to do is 
request.getParameter().getCagegoryId().getGif(), which you cant do since 
the getParameter method takes a String.
One way, not so pretty would be to use <%%> with casts and such:
 <% ((CagegoryObject) 
request.getParameter("CagegoryId")).getCagegoryId().getGif()%>.

Another way would be to use a bean:define tag (be sure to include the 
bean tag lib before trying this):
 " />

then you can write
 

Replace the CagegoryObject with whatever Object cagegoryId is a type of...
I haven't tested this, but it should work...
Claus
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: use EL in Struts 1.1

2004-10-27 Thread dmu2201
Rajesh wrote:
Hai Claus,
The code  



Is not parsed and directly appairs in the html source code.
 

You would have to use the struts html tags. I forgot to mention that, sorry.
try

instead

In my lib directry i have standard struts jars some site they added jstl.jar
and struts-el.jar.
I redownloaded struts1.1 but in the distribution binary zip file i didnât
found struts-el.jar
Is it really needed to parse ${} keys ? If yes where can i get it.
 

No you don't need the struts-el.jar, if you have the struts.jar in your 
lib dir. I don't, and I use EL :-)

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


Re: reset method causes values not displaying

2004-10-27 Thread dmu2201
Sebastian Ho wrote:
Hi
Can someone point out why this do not work, or why this work?
What this does, get a Actionform, set a value in it, add the ActionForm
into an Vector, set the Vector into Session. 

Strangely the new ActionForm is not displayed in the JSP returned by
ActionForward. It only appears if the ActionForm reset is not called
before returning the method.
How can the reset method affect my codes?
and yes, the values was printed out before returning and all the values
are there..
Why is that so? 

Thanks
Sebastian Ho
-
 


//RESET FORM   
//form.reset(mapping, request);

 

Since all Java calls with objects in them are call-by-reference you are 
actualling calling reset on the object you've just added to your Vector. 
I don't know how your reset method is implemented of course, but I would 
presume that all the values are reset to default values when you call 
reset.

If you want to preseve the values you've would have to make a copy of 
the form object and then add the copy to the vector...

Don't know if this is what you meant, but this is how I understand it :-)
Enjoy...
Claus
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: use EL in Struts 1.1

2004-10-27 Thread dmu2201
Rajesh wrote:
:) My Boss :0
How not working for me then 

Should i add any taglib ???
 

Yeah you have to use the HTML and Bean taglibs:
 <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
 <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
replace the uri with the relative path to your tlds
Can u give em any URL i can get basic use of EL ${...} objects
 

Yup:
  http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPIntro7.html
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: reset method causes values not displaying

2004-10-27 Thread dmu2201
Sebastian Ho wrote:
Now this is a Java question, if "XXX newForm = (XXX) form" resulted in
form and newForm having the same memory space? How do I really make a
duplicate copy with different memory space (beside using new, or is new
the only solution)? 

Sebastian Ho
 

Since this is Java and not C++ or C, you don't really have much control 
over the memory space or the way that Java passes your objects around. 
If you want to make a copy you have to use new. Otherwise Java will just 
use the same object all the way.

If you want a copy you have to create a new object of the same type and 
call all the set methods on the new object passing the values from the 
old object.
Another solution might be to have a constructor which takes a reference 
to the same object, which can then set all the values again:

XXX(XXX other)
{
 this.variable0 = other.variable0;
  this.variable1 = other.variable1;
 //and so on...
}
No matter what method you choose, I personnally prefer the last one, you 
have to use new! Don't think so much of the memory consumption since the 
GC will take care of that for you.

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


Re: nested checkboxes

2004-10-27 Thread dmu2201
aviral saini wrote:
hi
i am using nested checkboxes to display an array of
checkboxes - each row belonging to a new entity.
i also want the form to read these checkboxes when
they are selected(true) and unselected(false).
i have been able to implement the display but the
while reading the form, i get a union of all selected
checkboxes i.e. if i select the first checkbox for the
1st row and the second for the second row-i get first
and second checkboxes selected for all the rows.
can anyone suggest a solution to this or if he/she has
implemented something similar in an alternate manner?
 

What does your JSP look like? For all I can understand you are using the 
same property value in all your checkboxes. I too use nested checkboxes 
with a nested form bean approach, but I'm not sure if that is what you 
need... Please post a sample JSP, so people, including me, could better 
understand...

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


Re: Struts Tags Error

2004-11-02 Thread dmu2201
Geeth Narayanan wrote:
I am trying to use Struts 1.2.4 on Tomcat 5.0. I seem to get errors for
any of the struts tags including the tiles tag due to incompatibility
with JSP2.0 or something, I guess.
Here is the error:
:\wqt\vcs\tis\nb\tel-web-ube\build\generated\src\org\apache\jsp\jsp\shop
\Input_jsp.java:112:
_jspx_meth_html_base_0(javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp
.PageContext) in org.apache.jsp.jsp.shop.Input_jsp cannot be applied to
(org.apache.struts.taglib.html.HtmlTag,javax.servlet.jsp.PageContext)
 if (_jspx_meth_html_base_0(_jspx_th_html_html_0,
_jspx_page_context))
 ^
C:\wqt\vcs\tis\nb\tel-web-ube\build\generated\src\org\apache\jsp\jsp\sho
p\Input_jsp.java:148:
_jspx_meth_html_radio_0(javax.servlet.jsp.tagext.JspTag,javax.servlet.js
p.PageContext) in org.apache.jsp.jsp.shop.Input_jsp cannot be applied to
(org.apache.struts.taglib.html.FormTag,javax.servlet.jsp.PageContext) 

I am assuming others use struts tags running on tomcat 5.0 container. Is
there any reason why I get this error? If so, how can it be fixed?
Thanks.
Geeth
 

Where is this error from? There has to more to that stack trace, since 
the only think this says is that it is something with _jspx_page_context 
but not what the problem is...

I'm using several Struts tags with Tomcat 5.x and JSP 2.0 without any issues
Claus
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Struts Tags Error

2004-11-02 Thread dmu2201
Geeth Narayanan wrote:
I believe it is a compile time error than a runtime one. So, I don't
have a stack trace.
 

Ok then... How does the JSP look like then? Perhaps it is possible to 
see from that.

As far as I read the error it is because a JSP tag has been used 
combined with a Struts HTML tags, which it isn't that happy about. 
Please post the JSP causing the error...

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