Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
chaitanya karthikk
Ranch Hand
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
chaitanya karthikk
Ranch Hand
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Should I use custom tag libraries to achieve this?
 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using Struts2 tags you can call method directly. <s:property value=%{user.getCurrentUser()}/>
 
chaitanya karthikk
Ranch Hand
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This worked fine for me. But I don't know whether this approach is appreciated or not.

index1.jsp

struts.xml

LoginAction.java
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic