Re: Struts and Xdoclet

2003-10-23 Thread Anders Hermansen
Yes, that's because XDoclet has to know that ValidatorForm is an
ActionForm. It can't do that without struts.jar, because that's where the
information about ValidatorForm extends ActionForm is.


Anders

* Timothy Stewart ([EMAIL PROTECTED]) wrote:
> Figured out my own problem.  It seems that you have to have the struts.jar
> and commons-validator.jar in the class path for the WebDocletTask else it
> can't generate the form entry.
> 
> Happy Diwali
> 
> Timmy
> 
> -Original Message-
> From: Timothy Stewart 
> Sent: Thursday, October 23, 2003 2:07 PM
> To: [EMAIL PROTECTED]
> Subject: Struts and Xdoclet
> 
> 
> Anyone using struts with xdoclet.
> 
> I have the following form bean
> 
> import org.apache.struts.validator.ValidatorForm;
> 
> /**
>  * @struts.form name="LoginForm"
>  */
> public class LoginForm extends ValidatorForm
> {
>   private String _userName;
>   public LoginForm()
>   {
> super();
>   }
> 
>   public String getUserName()
>   {
>   return _userName;
>   }
> 
>   /**
>* 
>* @struts.validator type="required" msgkey="password.required" 
>*/
>   public void setUserName(String string)
>   {
>   _userName = string;
>   }
> }
> 
> and I am using xdoclet task as such
> 
> 
>  classname="xdoclet.modules.web.WebDocletTask">
>   
>   
>   
>   
> 
> force="${xdoclet.force}"
>  mergedir="merge">
>   
> 
>  distributable="false"
>   displayname="${app.name}"
>   mergedir="merge">
>   
> 
> 
> 
>  version="1.1"
>   mergedir="merge"/>
> 
>   
>   
>   
> 
> Running this task generates some information to the validation.xml and the
> struts-config.xml.
> 
> but it doesn't put the formbean element for this form into the form-beans
> section.
>   
>   
> 
>   
> 
> What am I doing wrong
> 
> Thanks,
> Timmy

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



Re: Access to the form bean from jsp?

2003-09-27 Thread Anders Hermansen
* Bjørn T Johansen ([EMAIL PROTECTED]) wrote:
> I need to access the form from my jsp page, but I can't seem to find a
> way to do this.. I need a name of the form to access but what is the
> name of the form instance that Struts generate? If I have a form named
> LoginForm does Struts make an instance called loginForm or does it
> choose a random name or?

You specify the name when you declare a form bean in struts-config.xml

in example:
  

In the jsp you can define a variable to point to this form using:
  
you can then use myLoginForm in any scriptlet.

You can also easily extract specific properties:
  

or you can print them directly:
  

This is all from memory, so I hope it's correct.


Hope this helps,
Anders

--
Anders Hermansen
YoYo Mobile as

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



Re: Reuse of JSP's and relative links

2003-09-17 Thread Anders
Good idea, but the tag needs to look up the action for form handling etc.
It can't do that if the correct action url isn't specified in the
action-attribute.

I've tried something like action="<%=path%>Edit.do" but as a lot of people
probably would know that doesn't work either. :)

Anders,

>You might be able to do this with an onsubmit handler
>
>ie.. 
>
>>-Original Message-
>>From: Daniel Wang [mailto:[EMAIL PROTECTED]
>>Sent: Wednesday, September 17, 2003 10:29 AM
>>To: Struts Users Mailing List
>>Subject: Re: Reuse of JSP's and relative links
>>
>>
>>You can't.  :(
>>
>>>- Original Message -
>>>From: "Anders" <[EMAIL PROTECTED]>
>>>To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>>>Sent: Wednesday, September 17, 2003 7:24 AM
>>>Subject: Re: Reuse of JSP's and relative links
>>>
>>> Ah, great! :)
>>>
>>> How can i do the same thing in the  tag? Anyone knows?
>>>
>>> Thanks,
>>> Anders,

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



Re: Reuse of JSP's and relative links

2003-09-17 Thread Anders
Ah, great! :)

How can i do the same thing in the  tag? Anyone knows?

Thanks,
Anders,

On Wed, 17 Sep 2003, Daniel Wang wrote:

> use href as opposed to page
>
> i.e. 
>
> - Original Message -
> From: "Anders" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, September 17, 2003 7:07 AM
> Subject: Reuse of JSP's and relative links
>
>
> > Hi,
> >
> > How can i get html:link to use relative links?
> >
> > I'm trying to reuse actions and JSP several places under different paths.
> > My problem is:
> >
> > The user enters through /secure/articles/Show.do and it displays the page
> > with articles. The links on the page lets you go to the next page and read
> > the full article.
> >
> > I then use the same action class for /secure/news/Show.do, and want to use
> > the same JSP's. It all works fine until the user clicks a link which
> > directs him to /secure/articles/Show.do?page=2 .
> >
> > How can i make html:link use relative paths? I would like to specify
> > html:link action="Show.do?page=2" and that would lead to
> > /secure/news/Show.do because the originating url said so.
> >
> > Thanks,
> > Anders,
> >
> >
> >
> > -
> > 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]



Reuse of JSP's and relative links

2003-09-17 Thread Anders
Hi,

How can i get html:link to use relative links?

I'm trying to reuse actions and JSP several places under different paths.
My problem is:

The user enters through /secure/articles/Show.do and it displays the page
with articles. The links on the page lets you go to the next page and read
the full article.

I then use the same action class for /secure/news/Show.do, and want to use
the same JSP's. It all works fine until the user clicks a link which
directs him to /secure/articles/Show.do?page=2 .

How can i make html:link use relative paths? I would like to specify
html:link action="Show.do?page=2" and that would lead to
/secure/news/Show.do because the originating url said so.

Thanks,
Anders,


--
 Anders Rene Sveen  +47-9244-3820
 [EMAIL PROTECTED]
--


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



Re: Call methods from JSTL

2003-08-03 Thread Anders Hermansen
* [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote:
> I get an "broken link" error :-(

Remove the . from the url:
http://developer.novell.com/tech/1126.html

Maybe you should also look closer at the "Learing about Struts" on the
struts website:
http://jakarta.apache.org/struts/learning.html


Hope this helps,
Anders

--
Anders Hermansen
YoYo Mobile as

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



Re: Iteration without Javacode

2003-08-03 Thread Anders Hermansen
* [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote:
> that eleminates one of the two scriplets, but leaves me with:
>  pageContext.setAttribute("bk2", new BuchKatalog().getBuecher());
> 
> 
> Anyway I can remove that one too?

You can set the "bk2" attribute in your action's execute method.

request.setAttribute("bk2", new BuchKatalog().getBuecher());

Then you can remove that scriptlet because the attribute is set in your
action.


Anders

--
Anders Hermansen
YoYo Mobile as

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



Re: MVC + Validation tips?

2003-03-31 Thread Anders
What kind of form are you using? I'm implementing a validatorform, and I
use the following hack to allow the same action to populate the form
before validation. This code is put in my implementation of the validate
method:

if (request.getMethod().equals("POST")) {
ActionErrors errors = super.validate(mapping, request);
return errors;
} else {
return null;
}

This code only triggers validation when there is a POST in progress.

Hope this helps.

Anders,

On Mon, 31 Mar 2003, Veaceslav Chicu wrote:

> Hi,
>
> I'm intereseted if you found a better solution, because I have this problem
> too
>
> best regards,
> Slavic
>
> - Original Message -
> From: "James Higginbotham" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, March 29, 2003 2:44 AM
> Subject: MVC + Validation tips?
>
>
> Hi,
>
> After searching the archives, I couldn't find an email that described a
> good solution to my question, and Ted's sample chapter on Validation
> didn't touch on it either. I have an action that is called which
> prepares the appropriate data and forwards to a JSP which contains a
> struts form. I have validation turned on now, so the action tries to
> validate and fails when its initially called, thus preventing my data
> from being loaded (it just goes to the input page, itself). My current
> workaround is to do the following:
>
>  type="my.editor.EditorAction"
> name="editor"
> scope="request"
> input="editor.default"
> validate="false">
>   path="editor.default"/>
> 
>
>  type="my.editor.EditorAction"
> name="editor"
> scope="request"
> input="editor.default">
>   path="editor.default"/>
>   path="/viewer.do"/>
>   path="/viewer.do"/>
> 
>
> I then call the /editor.do first, and that renders a JSP that will POST
> to /editorSave.do and validate the form. Is there a better way to handle
> this, or is this the preferred method when honoring MVC and only
> requesting pages via Actions?
>
> Thanks,
> James
>
>
>
>
> -
> 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]



Newbie Validation and DispathcAction

2003-02-25 Thread Anders
Hey,

I'm trying to implement this simple form/action.

- I'm using one DispatchAction that contains multiple methods. Show and
update will be relevant for this.
- I'm using one ValidationForm.
- The validationform is tied to the dispatchaction correctly and
everything works great. I can show the form, and submit it to update the
database. No validation is involved.
- I decide to try out the Validation framework, and test some of the
fields as required. The following happens:
- I go to the selected action (myAction.do?parm=show) to see the
  form
- The form displays with ActionErrors saying the fields are
  required and displays a blank form.

What I think happens: Because validation is set to true, and the validator
check for the required fields before the action can execute, it finds that
the form is empty and redirects to the JSP containing the form. Without
running the action. I was planning to populate the form in the show
method, but it never reaches this point. When using two separate Actions
you could turn off validation for show, and on for update. But I'm using
just one.

My question is? Is there some way to postpone the validation? Can i reach
a method in that action and populate the form before it is validated? Or
du I have to create a separate action just for this?

I probably can't, but it would be jolly good wouldn't it? ;)

Thanks,
Anders,


------
 Anders Rene Sveen
--


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



Re: Question about ActionErrors &

2003-01-31 Thread Anders Hermansen
* Ali Khan ([EMAIL PROTECTED]) wrote:
> Hi,
> 
> have made an simple struts-application. I got one problem.
> 
> That is when my actionerrors are shown generated with , 
> it shows null in start and in the end of the error-messages. Don't 
> understand why the null's occur ? It shows like this:
> 
> null Definition not filled
> Paymenttype not filled
> null

Struts is trying to set in the errors.header and errors.footer message
keys. But they are not defined.

> In ApplicationResources.properties:
> errors.typename=Definition not filled
> errors.comment=Paymenttype not filled

Add also:
errors.header = These errors occured:
errors.footer = 

you get the idea...


Hope this helps,
Anders

--
Anders Hermansen
YoYo Mobile as

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




Struts PowerPoint presentation

2002-06-06 Thread Anders Rosén

Hi,

I will teach JSP for a group of ASP developers next week. Nice challenge
;-) I have the Java and JSP material ready to go, but I would like to
introduce MVC as good way of building (web) applications. And what could
be better than to use Struts as a reference for the architecture.

Preparing and compiling training material is tedious, and that's why I
post here. Has anyone on the list compiled a PowerPoint on Struts?
Covering the basics, including some basics about coding and
configuration of Struts? And who wants to share the work?

"Every PowerPoint presentation is true, for certain values of true"

Regards,
/Anders


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




RE: Where to put the code for filling an ArrayList

2002-06-03 Thread Anders Rosén

As a custom tag? I do this in one of my applications, when populating
selects from a table in a database.

<%@ taglib uri="/WEB-INF/myTagLib.tld" prefix="custom" %>




   


You need to create the java class (subclassing TagSupport) implementing
the doStartTag() and optionally doEndTag() methods. Create the ArrayList
object and put it somewhere convinient, for example as an attribute in
the request object. You also need to define the new tag in a tld-file.

Regards,
/Anders

-Ursprungligt meddelande-
Från: hans albers [mailto:[EMAIL PROTECTED]] 
Skickat: den 3 juni 2002 08:56
Till: [EMAIL PROTECTED]
Ämne: Where to put the code for filling an ArrayList


Hi there

I want a dropdown-box filled by a bean.

I fill the Arrraylist inside the jsp as you can see, but I don't want to
have this code in the jsp because the data later comes from a database.
Where and how do I have to write this code (a...b) for the list be
accessed by the show.jsp? In the showForm.java or showAction.java or in
the Action.java of the page before the show.jsp?

In my show.jsp:
<% //a
  java.util.ArrayList list = new java.util.ArrayList();
  list.add(new LabelValueBean("Art1", "a1"));
  list.add(new LabelValueBean("Art2", "a2"));
  list.add(new LabelValueBean("Art3", "a3"));
  session.setAttribute("my_list",list);
  // b
%>


  

  

_
Testen Sie MSN Messenger für Ihren Online-Chat mit Freunden: 
http://messenger.msn.com


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



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




Re: Any hosting sites that use Struts?

2001-05-30 Thread Anders K. Olsen

You can take a look at http://www.webappcabaret.com

I don't have any experience with their service.

/Anders.

- Original Message - 
From: Jeff Trent 
To: [EMAIL PROTECTED] 
Sent: Wednesday, May 30, 2001 6:12 PM
Subject: Any hosting sites that use Struts?


Anyone know of a hosting facility that offers Java web hosting + Struts?