Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

New with Struts

 
Miguel Flecha
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all.
How do call an Action from another Action?
Thanks
Regards
Miguel
 
Nicola Guy
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to declare the actions in the struts-config.xml file that will call the other action once one is called
 
Miguel Flecha
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I declare it?
 
Nicola Guy
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Something like:

<action path="/register"
type="app.RegisterAction"
name="registerForm">
</action>

in the action-mapping section
 
Miguel Flecha
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But I'm not using a form
 
Nicola Guy
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you don't have to be.

wot are u doing?
 
Miguel Flecha
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm logging into an application. First I check all paremeter are OK and then I want to redirect to another Action that generates the main.jsp depending on the user
 
Nicola Guy
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used:

<actionpath="/logon"
type="app.LogonAction"
name="LogonForm"
scope="request"
validate="true"
input="/index.jsp">
<forward name="success" path="/LogonSuccess.jsp"/>
<forward name="failure" path="/LogonFailure.jsp"/>
</action>

LogonForm was the name of my bean which holds the user info
app.LogonAction was the action i wanted to run the index.jsp was where the action was called from and the forward are the pages to open depending on what was returned from the action.

hope this help because i am still very new to struts and am having alot of problems myself.. i can't even get inot Tomcat!!!
 
Miguel Flecha
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok. Thanks a lot
 
Pankaj Narang
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi miguel

I understood your application , you want to do a login module, for taht you simply need four things

1: Login.jsp
2:LoginForm.java
3:Loginaction.java
4:mian.jsp

the flow is that you put data in login.jsp, ou chaeck in validate method of loginform.java if correct you further go to loginaction and check the data with database forward it to main.jsp or back to login.jsp

This is simple then why you want to actions???

Best Regards
Pankaj
 
Miguel Flecha
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great. I just need a new jsp!
Thanks
 
Miguel Flecha
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now I have another problem.
The content in menu.jsp and body.jsp must be generated dynamically.

How do I do that?
How do I call an Action from there?
How does the Action returns the dynamic JSP?

Thanks a lot
 
Nicola Guy
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wot exactly are you looking to do?

wot details are you looking to display etc
 
Miguel Flecha
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm logging into a web application. I'm trying to load a menu bar and a body, and the content of both tiles must be dynamic, so I want to do it with an Action.
 
Nicola Guy
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im still really new to this as well but if I understand wot you mean you can use

<logic resent> or <logic:notPresent>

to have certain items displayed or hidden
 
Miguel Flecha
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mmmm... I think that doesn't work...
thanks anyway
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic