Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

fwd a page using button

 
Nishita Jain
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i m newbie in portal and portlet....
i m using struts+portlet ..so i m confused in 1 thing... i want to use link functionality in button i mean to say i want to do something like

<input type="button" name="Update" value="Update" onKlick="location . href='AddEditAccount.jsp';">

but this is not working.. if we user normal link the href tag will contain some value + lik name but in this case it is not happening so not forwarding to AddEditAccount.jsp page..
can any 1 help me how to do forwarding (only fwding) using button..

thank you,
Nishita
 
Nishita Jain
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anybody help in this?
 
Vinay Joseph
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can create a global forward in struts-config.xml & use that to forward to another jsp on click.

struts-config.xml
<forward name="[Forward Name]" path="[File Path]"/>

JSP:

<a href="[Forward Name]">Link</a>
 
Chaitanya Kommidi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have not used struts (we use our own framework) , but if this were a normal
MVC jsp with a controller , I would do something like this

In the JSP

<tr><td><a href="<portlet:actionURL>
<portlet aram name="mainGet" value="yes" />
</portlet:actionURL>">
<b> D</b></a></td></tr>

In the Controller :
In the Process action direct , interact with the model and the requisite logic and move the action to the VIEW which would display the JSP

public void processAction(ActionRequest request, ActionResponse response) throws PortletException, java.io.IOException {
....
....

if(command.equals("MASTER"))
request.getPortletSession().setAttribute("page",PAGE_MASTER);

}
response.setPortletMode(PortletMode.VIEW);


Thinking in these lines should help you for your struts app.

Hope this helps
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Having a portlet link back to itself is a tricky thing, much trickier than using a normal Servlet/JSP application.

I put together a web page that tries to explain the issues in a bit of detail:

http://www.technicalfacilitation.com/get.php?link=portleturi

The link is somewhat jetspeed centric, but the ideas are still valid.

I also put together a multimedia tutorial showing you how to code a JSR-168 portlet to link back to itself. I use a couple of other JSR-168 tags, such as defineObjects.


Look for the link that says: Forwarding to a JSP from a Portlet: Intro to the Portlet Tag defineObjects

http://www.technicalfacilitation.com/examscam/get.php?link=../portal/tutorials

Post more questions on the board. We love answering them!

-Cameron
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic