Meaningless Drivel is fun!
The moose likes Struts and the fly likes link  without actionform Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "link  without actionform" Watch "link  without actionform" New topic

link without actionform

ramandeep singh

Joined: Jan 16, 2007
Posts: 13
i am using this tag on test.jsp

<html:link action="/getRecord" ><html:img alt="raman" action="/getRecord"></html:img></html:link>

when i click the image
i want to runthe /getRecord action and get resultset from action into the session
and i wanna use the result set to see the list but i am not getting the result

Action file is :----------------->

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response, PreparedStatement ps)
throws Exception {
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
DataSource dataSource = null;
try {
dataSource = getDataSource(request);
conn = dataSource.getConnection();
PreparedStatement pst = conn.prepareStatement("SELECT * FROM coordresume");
rs = pst.executeQuery();
HttpSession session=request.getSession();
} catch (Exception ex) {
return mapping.findForward(SUCCESS);


<action path="/getRecord" type="submit.resume.getRecordAction" >
<forward name="success" path="/viewResume.jsp" />


<logic:notEmpty property="result">
<TR class="bodytext" vAlign="top" height="25">
<TD class="tableheader" align="center" width="35%" bgColor="#cccc99"></TD>
<TD width="35%" bgColor="#ebebe1"></TD>
<TD width="10%" bgColor="#ebebe1"></TD>
<TD width="10%" bgColor="#ebebe1"></TD>
<TD width="10%" bgColor="#ebebe1"> </TD>
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
What version of Struts are you using? Note that the action attribute of the html:img tag does not specify the action to execute when you click the button. Here is the description:

action The action, starting with a slash, that will render the image to be displayed by this tag.

- Brent
Milan Jagatiya
Ranch Hand

Joined: Jan 01, 2007
Posts: 164

Originally posted by ramandeep singh:
<html:link action="/getRecord" ><html:img alt="raman" action="/getRecord"></html:img></html:link>

no need to write action in both tag. remove action from img tag.


Milan.<br />I can because I think I can...
I agree. Here's the link:
subject: link without actionform
It's not a secret anymore!