Forums Register Login
Accessing session using hyperlink rather than submit button inside a JSP

I am looking to convert a logout button inside a jsp page to a hyperlink. Is there a way to access the session using a hyperlink instead of a form? Here is what I'm trying to convert:

<form method="POST" action="myservlet">
<input type="hidden" name="requestPageName" value="<%= REQUEST_PAGE_NAME %>">
<input type="hidden" name="actionCode" value="<%= ActionConstants.NMME_LOGOFF %>">
<input type="submit" value="Logoff">


<% if (appSession.getActionCode() == ActionConstants.ULGN_LOGON) {%>
<li id="cn-cmb6"><a href="<%=APP.JSP_PATH%>login.jsp"><fmt:message key="logout" bundle="${fmtCommonMenuBar}"/></a></li>
<%}else { %>
<li id="cn-cmb6"><a href="#"></a></li>

As you can see I am also using bundles, so I can't use session.invalidate() because my language toggle would no longer work once I return to the login page.

I'm not sure what you mean by "access a session". Forms and links submit requests, not "access sessions".

Perhaps you can explain a bit more about what you are trying to accomplish.

Also, Java code (scriptlets) in a JSP is a practice that has been discredited for a almost a decade now. It's long passed the time to use more modern techniques such as the JSTL and EL.
What I'm trying to figure out is how to pass the actionCode value to 'myservlet' through a url instead of a form.

This is a very old application and we are in the process of trying to eliminating as much Java code in the JSPs. The code provided has not yet been converted fully.
You can set the form method to "get", and submit the form under script control when the link is clicked.
money grubbing section goes here:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database

This thread has been viewed 1180 times.

All times above are in ranch (not your local) time.
The current ranch time is
Jan 16, 2019 10:57:49.