• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

link without actionform

 
ramandeep singh
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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();
session.setAttribute("result",rs);
} catch (Exception ex) {
}
return mapping.findForward(SUCCESS);
}




webconfig--------------------------------->

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



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>
</TR>
</logic:notEmpty>
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic