aspose file tools*
The moose likes Struts and the fly likes How to create object and call a method in jsp using struts 2 tags Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to create object and call a method in jsp using struts 2 tags" Watch "How to create object and call a method in jsp using struts 2 tags" New topic
Author

How to create object and call a method in jsp using struts 2 tags

chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

Hi all, I am Chaitanya, I am new to struts and its tags. I am learning struts2 and google app engine. I am working on running a struts application on app engine. As a part of it I have to create login and logout urls using google's UserService class's methods. Using scriptlets I used to like this

Now I have to do the same using struts 2 tags. Can anyone help me how to achieve this?

Thank you all in advance. Good day.


Love all, trust a few, do wrong to none.
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

Should I use custom tag libraries to achieve this?
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

Using Struts2 tags you can call method directly. <s:property value=%{user.getCurrentUser()}/>


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

Mohana Rao wrote:Using Struts2 tags you can call method directly. <s:property value=%{user.getCurrentUser()}/>

I tried with this

But it is not working, I am not getting an error also.
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

This worked fine for me. But I don't know whether this approach is appreciated or not.

index1.jsp

struts.xml

LoginAction.java
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to create object and call a method in jsp using struts 2 tags