This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA 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: 800

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: 800

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: 800

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: 800

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

index1.jsp

struts.xml

LoginAction.java
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to create object and call a method in jsp using struts 2 tags