Re: Problem with Tiles an ActionForms

2006-12-29 Thread Sebastian Marten
Thanks for your answer.

If i set validate="true" the layout is not applied. I see only the page
"createuser.jsp"

If i set validate="false" it works fine...

Why?


Ok here my config files:
If you nee more informations, just say it.

struts-config.xml






#
tiles-defs.xml







##
createuser.jsp:














[..More inputs..]






  





#
createUserActionForm.java

public class CreateUserActionForm extends
org.apache.struts.action.ActionForm {

private int id;
private String nick;
private String name;
[..]

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public String getNick() {
return nick;
}

public void setNick(String nick) {
this.nick = nick;
}
[...]

public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request) {
ActionErrors errors = new ActionErrors();

if (getNick() == null || getNick().length() < 4 ) {
errors.add("nick", new ActionMessage("error.nick.required"));
}

if (getName() == null || getName().length() < 4) {
errors.add("name", new ActionMessage("error.name.required"));
}
if (getVname() == null || getVname().length() < 4) {
errors.add("name", new ActionMessage("error.vname.required"));
}
[...]
 return errors;

##
CreateUser.java

public class CreateUser extends Action {

/* forward name="success" path="" */
private final static String SUCCESS = "success";
private final static String FAILED = "failed";

 public ActionForward execute(ActionMapping mapping, ActionForm  form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
 CreateUserActionForm createuser = (CreateUserActionForm) form;

user newuser = new user();
  newuser.setNick(createuser.getNick());
newuser.setName(createuser.getName());
newuser.setVname(createuser.getVname());
[...]
 if (!userliste.reg_user(newuser)){
return mapping.findForward(FAILED);
}

return mapping.findForward(SUCCESS);


##


Laurie Harper schrieb:
> You can certainly use automatic validation together with Tiles, so
> that's not the problem. You'll need to post your relevant
> struts-config.xml excerpts and tiles-defs, and possibly relevant bits of
> JSP so we can see what you're doing wrong.
> 
> L.
> 
> Sebastian Marten wrote:
>> After several hours of searching i found the problem.
>> All pages work, if I set >validate="false"< in the struts config.
>> So I can't use the validate method of the bean?
>> Is there an alternative for this method?
>>
>> Best regards,
>> Sebastian Marten
>>
>>
>> Sebastian Marten schrieb:
>>> Hello List,
>>>
>>> I have a problem with Struts Tiles.
>>>
>>> First I wrote all sub-page's for a very little Web shop.
>>>
>>> Then i started with tiles and created a simple test layout.
>>> Nothing special, but it works.
>>> I have several normal pages, like the page "katliste.jsp"
>>> I click the link to the related action:
>>>
>>> Unser Angebot
>>> And then the page is displayed in the Layout.
>>>
>>> So far, so good.
>>> Then I have 2 pages with a Struts Action Form and Action Form bean.
>>> I Created the definition for this page in the tiles-xml and configured
>>> the action forwards in the struts-config.
>>> But then i create a link the /createuser.do:
>>> Hier können sie sich Anmelden
>>>
>>> I see only the corresponding .jsp page an not the hole layout.
>>>
>>> There is the Problem?
>>>
>>> I hope you can help me!
>>>
>>> Best regards,
>>> Sebastian Marten
>>>
>> [.]
>>
>>
>>
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



signature.asc
Description: OpenPGP digital signature


Re: Problem with Tiles an ActionForms

2006-12-28 Thread Sebastian Marten

After several hours of searching i found the problem.
All pages work, if I set >validate="false"< in the struts config.
So I can't use the validate method of the bean?
Is there an alternative for this method?

Best regards,
Sebastian Marten


Sebastian Marten schrieb:
> Hello List,
> 
> I have a problem with Struts Tiles.
> 
> First I wrote all sub-page's for a very little Web shop.
> 
> Then i started with tiles and created a simple test layout.
> Nothing special, but it works.
> I have several normal pages, like the page "katliste.jsp"
> I click the link to the related action:
> 
> Unser Angebot
> And then the page is displayed in the Layout.
> 
> So far, so good.
> Then I have 2 pages with a Struts Action Form and Action Form bean.
> I Created the definition for this page in the tiles-xml and configured
> the action forwards in the struts-config.
> But then i create a link the /createuser.do:
> Hier können sie sich Anmelden
> 
> I see only the corresponding .jsp page an not the hole layout.
> 
> There is the Problem?
> 
> I hope you can help me!
> 
> Best regards,
> Sebastian Marten
> 
[.]





signature.asc
Description: OpenPGP digital signature


Problem with Tiles an ActionForms

2006-12-28 Thread Sebastian Marten
Hello List,

I have a problem with Struts Tiles.

First I wrote all sub-page's for a very little Web shop.

Then i started with tiles and created a simple test layout.
Nothing special, but it works.
I have several normal pages, like the page "katliste.jsp"
I click the link to the related action:

Unser Angebot
And then the page is displayed in the Layout.

So far, so good.
Then I have 2 pages with a Struts Action Form and Action Form bean.
I Created the definition for this page in the tiles-xml and configured
the action forwards in the struts-config.
But then i create a link the /createuser.do:
Hier können sie sich Anmelden

I see only the corresponding .jsp page an not the hole layout.

There is the Problem?

I hope you can help me!

Best regards,
Sebastian Marten



createuser.jsp













<.>


##



Layout
 









 













###

Base Definition in tiles-defs.xml














Problem???








#


struts-config.xml













signature.asc
Description: OpenPGP digital signature