wood burning stoves 2.0*
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
Author

link without actionform

ramandeep singh
Greenhorn

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();
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

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
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.


Milan.<br />I can because I think I can...
 
GeeCON Prague 2014
 
subject: link without actionform